Skip to content

Improve SQLite migrations for adding/removing NOT NULL and CHECK constraints #38104

@0xced

Description

@0xced

What problem are you trying to solve?

Currently, adding/removing NOT NULL and CHECK constraints performs a table rebuild in SQLite. It would be more efficient to use ALTER TABLE statements.

Describe the solution you'd like

The table rebuild could be simplified by issuing much simpler ALTER TABLE statements instead.

This is new in SQLite 3.53.3 (see 3.a.)

New SQL language features: Enhance ALTER TABLE to permit adding and removing NOT NULL and CHECK constraints.

Note that this would probably require to detect the actual SQLite version being used to know if the new ALTER TABLE statements can be used or if it must fallback to a table rebuild, which might be tricky.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions