Supabase primary key type

When I run introspect, the primary key of my tables look something like this:
id: bigint("id", { mode: "number" }).primaryKey().notNull(),
id: bigint("id", { mode: "number" }).primaryKey().notNull(),
Problem is this doesn't auto-increment upon insert. It seems like there's no support for integer "generated always as identity" in Drizzle which is how Supabase does things by default. Does this mean I have to switch all my primary keys to bigserial instead?
No description
4 Replies
nikhil
nikhilOP12mo ago
Kind of dissapointed that drizzle doesn't support "generated always as identity" since this is recommended by postgres instead of serial. But I was able to get past this by migrating my primary keys to serial. Got the error: or: type "serial" does not exist but I got around it by recreating my tables in Supabase (export table data as csv and reimported which was kind of annoying).
Angelelz
Angelelz12mo ago
There is a PR open for this. We should get it pretty soon https://github.com/drizzle-team/drizzle-orm/pull/1471
GitHub
Feat: Drizzle-ORM support for Generated columns by Angelelz · Pull ...
This PR will close #261, will close #579 and will close #1464. The API for generated columns will look like this: const users = sqliteTable( 'users', { id: int('id').primary...
nikhil
nikhilOP12mo ago
@Angelelz once this is done will there be an easy way to migrate to "generated always as identity"? When I migrated to serial, I had to recreate all tables because of the "serial" does not exist error
Angelelz
Angelelz12mo ago
I think that if you move to serial you have issues, but not the way around. I'm honestly not sure
Want results from more Discord servers?
Add your server