diff --git a/src/db/schema.ts b/src/db/schema.ts index 0ce46b5..3fec67e 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -1,7 +1,7 @@ import { pgTable, uuid, varchar, timestamp, pgEnum, numeric } from "drizzle-orm/pg-core"; export const users = pgTable("users", { - id: uuid("id").primaryKey().defaultRandom(), + id: uuid("id").primaryKey().$defaultFn(() => crypto.randomUUID()), username: varchar("username", { length: 50 }).notNull().unique(), passwordHash: varchar("password_hash", { length: 255 }).notNull(), createdAt: timestamp("created_at", { withTimezone: true, mode: "date" }) @@ -16,7 +16,7 @@ export const assetTypeEnum = pgEnum("asset_type_enum", [ ]); export const assets = pgTable("assets", { - id: uuid("id").primaryKey().defaultRandom(), + id: uuid("id").primaryKey().$defaultFn(() => crypto.randomUUID()), symbol: varchar("symbol", { length: 20 }).notNull().unique(), type: assetTypeEnum("type").notNull(), baseCurrency: varchar("base_currency", { length: 10 }).notNull(), @@ -33,7 +33,7 @@ export const transactionTypeEnum = pgEnum("transaction_type_enum", [ ]); export const transactions = pgTable("transactions", { - id: uuid("id").primaryKey().defaultRandom(), + id: uuid("id").primaryKey().$defaultFn(() => crypto.randomUUID()), assetId: uuid("asset_id") .notNull() .references(() => assets.id),