© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•15mo ago•
3 replies
Eduard Dyckman

Primary key is not applied

Drizzle doesn't generate a primary key statement in the migration. Here is the schema:
export const usersTable = pgTable(
  "users",
  {
    slackUserId: text().notNull(),
    slackTeamId: text().notNull(),
    tokenSet: jsonb().notNull(),
    createdAt: timestamp().notNull().defaultNow(),
  },
  (t) => [{ pk: primaryKey({ columns: [t.slackUserId, t.slackTeamId] }) }],
);
export const usersTable = pgTable(
  "users",
  {
    slackUserId: text().notNull(),
    slackTeamId: text().notNull(),
    tokenSet: jsonb().notNull(),
    createdAt: timestamp().notNull().defaultNow(),
  },
  (t) => [{ pk: primaryKey({ columns: [t.slackUserId, t.slackTeamId] }) }],
);

drizzle-kit: "^0.30.0"
drizzle-orm: "^0.38.0"
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

Column primary key not working
Drizzle TeamDTDrizzle Team / help
3y ago
Compostie primary key of a composite primary key
Drizzle TeamDTDrizzle Team / help
2y ago
Composite Primary Key?
Drizzle TeamDTDrizzle Team / help
16mo ago
Dropping Primary Key
Drizzle TeamDTDrizzle Team / help
3y ago