From c8837f8ea129882076a1613ed1720313102a64fc Mon Sep 17 00:00:00 2001 From: Jon Griffith Date: Thu, 24 Oct 2024 20:51:17 -0700 Subject: [PATCH] resolve #1980 --- .../extras/src/server/db/schema-drizzle/base-postgres.ts | 4 ++-- .../extras/src/server/db/schema-drizzle/with-auth-postgres.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cli/template/extras/src/server/db/schema-drizzle/base-postgres.ts b/cli/template/extras/src/server/db/schema-drizzle/base-postgres.ts index 8e6f2f99e1..3878a981fd 100644 --- a/cli/template/extras/src/server/db/schema-drizzle/base-postgres.ts +++ b/cli/template/extras/src/server/db/schema-drizzle/base-postgres.ts @@ -4,8 +4,8 @@ import { sql } from "drizzle-orm"; import { index, + integer, pgTableCreator, - serial, timestamp, varchar, } from "drizzle-orm/pg-core"; @@ -21,7 +21,7 @@ export const createTable = pgTableCreator((name) => `project1_${name}`); export const posts = createTable( "post", { - id: serial("id").primaryKey(), + id: integer("id").primaryKey().generatedByDefaultAsIdentity(), name: varchar("name", { length: 256 }), createdAt: timestamp("created_at", { withTimezone: true }) .default(sql`CURRENT_TIMESTAMP`) diff --git a/cli/template/extras/src/server/db/schema-drizzle/with-auth-postgres.ts b/cli/template/extras/src/server/db/schema-drizzle/with-auth-postgres.ts index 5ce3f9c252..43e62439f7 100644 --- a/cli/template/extras/src/server/db/schema-drizzle/with-auth-postgres.ts +++ b/cli/template/extras/src/server/db/schema-drizzle/with-auth-postgres.ts @@ -4,7 +4,6 @@ import { integer, pgTableCreator, primaryKey, - serial, text, timestamp, varchar, @@ -22,7 +21,7 @@ export const createTable = pgTableCreator((name) => `project1_${name}`); export const posts = createTable( "post", { - id: serial("id").primaryKey(), + id: integer("id").primaryKey().generatedByDefaultAsIdentity(), name: varchar("name", { length: 256 }), createdById: varchar("created_by", { length: 255 }) .notNull()