When I create a table in sqlDelight, and have `id...
# squarelibraries
c
When I create a table in sqlDelight, and have
id INTEGER PRIMARY KEY NOT NULL
it seems to auto increment on its own (which is fine), but I would've thought that i had to add
AUTOINCREMENT
. is that just a sqlite thing, or is sqldelight just doing it on my behalf?
d
today i learned 5
v
That's also what I would have assumed. It's actually a pretty smart optimization. But only after reading this - https://sqlite.org/queryplanner.html - super interesting read and starts from zero.
c
I just re-read and noticed this line
1. If the AUTOINCREMENT keyword appears after INTEGER PRIMARY KEY, that changes the automatic ROWID assignment algorithm to prevent the reuse of ROWIDs over the lifetime of the database. In other words, the purpose of AUTOINCREMENT is to prevent the reuse of ROWIDs from previously deleted rows.
Interesting!!!
604 Views