[How To?] Generate uuids properly on cloudflare d1 sqlite...
I am running an app with Drizzle, TRPC, and Cloudflare D1 sqlite database:
My initial project databasse schema looks like:
I am trying to add a uuid column to the table in addition to autoincrementing the id column and making the other columns not required. First I am trying to ad a uuid column.
I have researched this in a couple places, cant seem to find what I am looking for. I want a uuid column that automatically generates a uuid when i insert a record. Seems to be possible with mysql but not sqlite?
Here is the uuid column I have been able to push through drizzle to the database:
I have been able to generate the migration (
This gets pushed to the database via wrangler with a
My initial project databasse schema looks like:
I am trying to add a uuid column to the table in addition to autoincrementing the id column and making the other columns not required. First I am trying to ad a uuid column.
I have researched this in a couple places, cant seem to find what I am looking for. I want a uuid column that automatically generates a uuid when i insert a record. Seems to be possible with mysql but not sqlite?
Here is the uuid column I have been able to push through drizzle to the database:
I have been able to generate the migration (
drizzle-kit generate:sqlite --schema=./src/db/schema.ts --out=./migrations)This gets pushed to the database via wrangler with a
wrangler d1 migrations apply production --local command.