diff --git a/src/db/db.ts b/src/db/db.ts index d9a4c27..ec08fbf 100644 --- a/src/db/db.ts +++ b/src/db/db.ts @@ -2,6 +2,7 @@ import { drizzle } from "drizzle-orm/postgres-js"; import postgres from "postgres"; import * as schema from "./schema"; import "dotenv/config"; +import { sql } from "drizzle-orm"; // const connectionString = process.env.DATABASE_URL as string; const connectionString = diff --git a/src/db/schema.ts b/src/db/schema.ts index a3b2571..10f21d3 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -1,6 +1,7 @@ -import { pgEnum, pgTable, timestamp, uuid, varchar } from "drizzle-orm/pg-core"; +import { pgEnum, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core"; +import { sql } from "drizzle-orm"; -export const DateTable = pgTable("date", { +export const DateTable = pgTable("dates", { date: timestamp("date", { withTimezone: true }) .unique() .notNull() @@ -16,10 +17,10 @@ export const EventVariant = pgEnum("eventVariant", [ "default", ]); -export const EventTable = pgTable("event", { +export const EventsTable = pgTable("events", { id: uuid("eventId").primaryKey().defaultRandom(), - title: varchar("title", { length: 255 }).notNull(), - companyName: varchar("companyName", { length: 128 }) + title: text("title").notNull(), + companyName: text("companyName") .notNull() .unique() .references(() => SymbolsTable.symbol), @@ -31,6 +32,17 @@ export const EventTable = pgTable("event", { }); export const SymbolsTable = pgTable("symbols", { - symbol: varchar("symbol", { length: 16 }).notNull().primaryKey().unique(), - companyName: varchar("companyName", { length: 128 }).notNull().unique(), + symbol: text("symbol").notNull().primaryKey().unique(), + companyName: text("companyName").notNull().unique(), }); + +// export const ThemeMode = pgEnum("themeMode", ["light", "dark", "system"]); + +// export const UserPreferencesTable = pgTable("userPreferences", { +// // userId: text("userId").primaryKey().notNull().unique().references(() => U), +// theme: ThemeMode("theme").default("dark").notNull(), +// }); + +// export const UsersTable = pgTable("users", { +// userId: text("userId"), +// });