-
Notifications
You must be signed in to change notification settings - Fork 47
Add support for sqlite strict mode. #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The tests pass but looking for ideas on how to test strict mode and how to enable strict mode as a config option. |
@warmwaffles nudge |
@fire I had a bit of a family emergency come up over the weekend. I'll be able to take a look at this tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like these changes. My BIGGEST concern is backwards compatibility with existing sqlite databases that were using this prior to the change.
@fire according to the sqlite documentation, the table option is all you need. There is no way to enable it by default upon opening an sqlite database. Generally speaking I love strict types, but I do appreciate that sqlite allows us to specify custom types in the database in the way we do. But I say let's merge this. |
* Handle TEXT_UUID to TEXT. * A uuid is TEXT or BLOB. * Swap :datetime since it is passed to the database directly. * The type ecto uses is :utc_datetime. * A boolean is an INTEGER.
Can you help make strict table test? |
Ready to go! |
Yea @fire I'll throw together some tests and commit them to main after this is merged. |
@fire when I get some time today, I'll sling together some more integration tests for strict vs non strict. Once that's done, I'll cut major release since this does break backwards compatibility some what. |
@fire I added a note to the changelog about the breaking change under the unreleased section. I think I am going to cut a |
@fire so I have been chatting with @jeregrine about strict mode. Is there a specific hard requirement as why it is necessary or just a nice to have? One of the reasons I originally left out the strict mode was being able to handle Another thing we sort of lose is the ability to specify a field as an |
I wanted to be able to enforce strict and I didn't think starting a fork was the right answer. Is there something we can do about the loss? |
The request for sql strict mode is because I was using postgresql and most other sql engines don't offer the type flexibility of sqlite. So the reasoning are more religious in nature to match what the consensus sql developers have. |
For review. I am not sure how to enable strict mode. I added the lines
options: "STRICT"
to force strict mode.This fixes problems with uuids, booleans and datetimes on strict mode. We must use the correct sql types.
Help on how to run the test suite.
https://www.sqlite.org/draft/stricttables.html