Skip to content

I think sqlite3 supports check constraints #26

Description

@warmwaffles

https://github.com/warmwaffles/exqlite/blob/cbd1e9c6eef74355c025158c341ccc678fe7446f/lib/ecto/adapters/exqlite/connection.ex#L510-L513

If you drill into the column definition you'll see that CHECK is allowed https://sqlite.org/lang_altertable.html

It doesn't support, exclude although if you can just negate the statement it might suffice.

Activity

  1. warmwaffles commented on Mar 10, 2021

    @warmwaffles
    MemberAuthor

    It's not just on ALTER TABLE, it also exists for for CREATE TABLE too. This doesn't necessarily need to be in for 1.0 milestone. But I think I'd like to explore getting this in and tested to ensure that sqlite does support it.

  2. warmwaffles commented on Mar 16, 2021

    @warmwaffles
    MemberAuthor

    So sqlite supports check constraints. But it does not support adding it to a column that exists. It has to be specified when the column is created.

  3. kevinlang commented on Apr 8, 2021

    @kevinlang
    Member

    Looked at this one. We can easily support this in a similar manner to how we support :collate for text-insensitive columns. The beauty of ecto/ecto_sql is that we are not limited to the list of documented options shown in Ecto.Migration#add/3

    I'll add this with some tests in the next week.

  4. kevinlang commented on Apr 8, 2021

    @kevinlang
    Member

    I should also clean up how we do collate and move that to the column_options func instead.

    And also add documentation that we do not support create constraint but do support this way.

  5. self-assigned this
    on Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions