Lighter-swift / Lighter

Swift APIs for SQLite: Type-safe down to the schema. Very, very, fast. Dependency free.

Home Page:https://lighter-swift.github.io/documentation/lighter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a separate type for "integer pkeys" in SQLite3Schema

helje5 opened this issue · comments

Lighter currently considers all int pkeys as database generated, but that is only true if they are spelled explicitly as INTEGER (case doesn't matter). I.e. just id INT PRIMARY KEY doesn't actually work.
We should replicate the SQLite behaviour and only consider a property as autogenerated if it matches the requirements.

This probably warrants a new type or marker in SQLite3Schema.

Implemented, and seems to work fine. "INTEGER" and "INT" are now detected as separate schema types (but are both mapped to .integer properties).

Only "INTEGER" columns are setup with the autogenerated key behaviour (i.e. are ignored at INSERT time).