RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQLite `INTEGER PRIMARY KEY` does not create `Generated` type for column

torte opened this issue · comments

When defining a table column with INTEGER PRIMARY KEY in SQLite, it is an alias for the interal rowid which basically is auto-generated each time a new row is inserted. When using kysely codegen with a defined sqlite column in a table like this, it will instead just generate the plain type (in this case number). I have to explicitly use the AUTOINCREMENT keyword in my table definition for the primary key and then the code will be generated correctly. That being said, autoincrement should not be used for reasons of being a bit more resource intensive (at least not for primary keys). I can provide examples if needed.

Otherwise, thank you for the great tool. Really love it saved me so much time already.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar