Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up"Trait bound for NaiveDateTime is not satisfied" when adding a timestamp column #971
Comments
This comment has been minimized.
|
Wow, this is a nice report :o Your |
This comment has been minimized.
|
Thank you! That did it. Now it's giving me an error saying that it can't parse Datetime, but I'll try and sort that one out on my own ;) |
This comment has been minimized.
|
Huuu if you inserted those values with diesel it should work. Maybe you ran into a bug in the implementation of Datetime for sqlite |
This comment has been minimized.
|
Hmmm. Good point. But honestly, I'm willing to bet it's a "me problem" ;). I'll try to flesh out the issue and I'll add a comment here if it turns out to be at all related to this. Just in case it helps out another beginner in the future. Unrelated, but would a PR for an issue template be welcomed? That aside, I'm happy with this solution and I'll close the issue. Thank you again for your help! |
kieraneglin
closed this
Jun 27, 2017
This comment has been minimized.
|
See #969 for the issue template. (And yes a PR would be welcome :)) |
This comment has been minimized.
|
Update: The issue was because I had a raw-SQL seed file. Like you said, if I entered the data through Diesel, everything worked as expected. |
kieraneglin commentedJun 27, 2017
•
edited
Hello! I know this is small, however I cannot find anything that helps online or in the docs and I feel it may be a bug.
Please keep in mind, this is my first ever time using Rust (or any low-level language). I'm coming from Ruby and JavaScript. This may be something very simple, but my research before posting this didn't lead to anything.
Anyway, off to it:
Versions
Features
Problem description
When you have a timestamp
DATETIMEfield in your DB, you cannot useNaiveDateTimeas it's type in Rust. When you do, compilation fails with this message:This message didn't occur and the code otherwise worked before the addition of a timestamp.
Steps to reproduce
created_at DATETIME DEFAULT CURRENT_TIMESTAMPNaiveDateTimeto the timestamp fieldMy setup
Model
Migration
"Controller"
Here's a link to the repo as well. It's pretty-well empty, so it may as well be a minimal reproducible set for this error.
Disclaimer
Again, this is my first Rust project. So if I forgot any information or if you need me to elaborate, please let me know!
Thank you for your time.