POSTS SQL SQLITE TIL

SQLite and primary key UUID columns

Auto-Generating UUID Primary Keys in SQLite: A Simple Default Value Trick

After loading the UUID extension, in SQLite you can create tables with a UUID primary key with an automatic value defined by its default value:

1
2
3
create table my_table (
  uuid blob primary key default(uuid_blob(uuid())),
);

Something like autoincrementing for UUID columns.