Comments (4)
@yadakhov
I got the same issue and DB:raw('NOW()') also not working.
from insert-on-duplicate-key.
You can move the NOW() into PHP application level.
$now = date('Y-m-d H:i:s');
$row = ['id' => 1, ..., 'create_time' => $now, 'update_time' => $now];
Model::insertOnDuplicateKey($row);
from insert-on-duplicate-key.
$now = date('Y-m-d H:i:s');$row = ['id' => 1, ..., 'create_time' => $now, 'update_time' => $now];Model::insertOnDuplicateKey($row);
from insert-on-duplicate-key.
@yadakhov Your workaround is not works, the error message as below.
Errror: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10:59:24' at line 3 (SQL: INSERT INTO user_relations
(customer_user_id
,user_id
,created_at
,updated_at
) VALUES (1012,338,2018-10-04 10:59:24,2018-10-04 10:59:24) ON DUPLICATE KEY UPDATE updated_at = 2018-10-04 10:59:24)
My Laravel version: 5.7
from insert-on-duplicate-key.
Related Issues (20)
- Support table prefixed.
- version 1.x HOT 1
- Return Affected Rows HOT 3
- Use the connection that was set on the model instance HOT 2
- Extending Your Class HOT 1
- Incremental values on UPDATE HOT 7
- SQLSTATE[HY000]: General error: 1390 Prepared statement contains too many placeholders HOT 4
- insertOnDuplicateKey $updateColumns parameter doesn't allow strings HOT 1
- Creating wrong record HOT 3
- Slow for more than a certain number of records HOT 1
- Punctuated strings HOT 1
- Multiple Scheme? HOT 1
- how to work with uuid
- Anyway to get this to work with the query builder instead of a model? HOT 3
- More complex update logic HOT 1
- Low performance with not too big insert datas
- Possible SQL injection HOT 1
- Order of data key => value pairs HOT 2
- Do not have any handling for timestamps
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from insert-on-duplicate-key.