© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•16mo ago•
1 reply
bob_merlin

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
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
postgres-js
and this is the repo where i have the issue: https://github.com/Blackwidow-sudo/auth-starter
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

drizzle-kit introspect schemaFilters parameter ignored
Drizzle TeamDTDrizzle Team / help
15mo ago
Drizzle Studio incompatibility with generatedAlwaysAsIdentity
Drizzle TeamDTDrizzle Team / help
17mo ago
issue drizzle-kit pull -> drizzle-kit-generate -> drizzle-kit migrations
Drizzle TeamDTDrizzle Team / help
9mo ago
Drizzle Kit
Drizzle TeamDTDrizzle Team / help
15mo ago