Drizzle TeamDT
Drizzle Team3y ago
11 replies
Fyzz

PostgreSQL "type serial does not exist"

I'm getting an error when using serial and primary key. Just trying out postgres for the first time so its very possible I messed something up, the serial type works perfect on non primary key fields

export const users = pgTable(
  "users",
  {
    id: serial('id').primaryKey(),
    clerk_id: varchar("user_id", { length: 50 }),
    username: varchar("username", { length: 100 }),
  },
  (users) => {
    return {
      username_idx: uniqueIndex("username_idx").on(users.username),
    };
  }
);


#this is the error displayed when try to push changes
error: type "serial" does not exist
Was this page helpful?