generatedAlwaysAsIdentity() gets ignored by drizzle-kit

This drives me insane, am i just dumb and doing something wrong or is this a bug? I have the following schema:
export const users = pgTable('users', {
id: integer('id').primaryKey().generatedAlwaysAsIdentity(),
username: varchar('username', { length: 256 }).notNull(),
email: varchar('email', { length: 256 }).notNull().unique(),
passwordHash: text('password_hash').notNull()
})
export const users = pgTable('users', {
id: integer('id').primaryKey().generatedAlwaysAsIdentity(),
username: varchar('username', { length: 256 }).notNull(),
email: varchar('email', { length: 256 }).notNull().unique(),
passwordHash: text('password_hash').notNull()
})
but when i run drizzle-kit push i get the following SQL:
CREATE TABLE IF NOT EXISTS "users" (
"id" integer PRIMARY KEY NOT NULL,
"username" varchar(256) NOT NULL,
"email" varchar(256) NOT NULL,
"password_hash" text NOT NULL,
CONSTRAINT "users_email_unique" UNIQUE("email")
);
CREATE TABLE IF NOT EXISTS "users" (
"id" integer PRIMARY KEY NOT NULL,
"username" varchar(256) NOT NULL,
"email" varchar(256) NOT NULL,
"password_hash" text NOT NULL,
CONSTRAINT "users_email_unique" UNIQUE("email")
);
And this leads to errors when trying to insert new users. Im using postgres-js and this is the repo where i have the issue: https://github.com/Blackwidow-sudo/auth-starter
1 Reply
bob_merlin
bob_merlinOP2mo ago
ok i just upgraded the dependencies and now it works finally:
dependencies:
- drizzle-orm 0.33.0
+ drizzle-orm 0.35.3

devDependencies:
- drizzle-kit 0.22.8
+ drizzle-kit 0.26.2
dependencies:
- drizzle-orm 0.33.0
+ drizzle-orm 0.35.3

devDependencies:
- drizzle-kit 0.22.8
+ drizzle-kit 0.26.2
Want results from more Discord servers?
Add your server