#autoIncrement for astro db

3 messages · Page 1 of 1 (latest)

lament gull
#

I searched about autoIncrement in discord and github, but couldn't find how can I set my table's id is autoIncrement or not. is there any docs for that?

lilac yew
#

I think Astro DB uses Drizzle ORM, so it should be possible, but I think @vast egret is our expert of DB, so don't take my word for it, he knows much better

vast egret
#

column.number({ primaryKey: true })

In SQLite, integer primary key implicitly makes the column auto-incrementing.

All you need is to use Number column type and set it as primary key and it will do everything for you! (since AstroDB uses libsql/sqlite under the hood)