-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.ts
More file actions
35 lines (32 loc) · 1.09 KB
/
schema.ts
File metadata and controls
35 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import {
pgTable,
serial,
text,
varchar,
timestamp,
jsonb
} from "drizzle-orm/pg-core";
import { sql } from "drizzle-orm";
export const users = pgTable("users", {
id: serial("id").primaryKey(),
name: text("name").notNull(),
email: varchar("email", { length: 255 }).notNull().unique(),
password: text("password").notNull(),
createdAt: timestamp("created_at").notNull().default(sql`now()`),
});
export const questions = pgTable("questions", {
id: serial("id").primaryKey(),
question: text("question").notNull(),
content: text("content").notNull(),
answer: text("answer").notNull(),
});
// Fix logs table to match logger expectations
export const logs = pgTable("logs", {
id: serial("id").primaryKey(),
userId: text("user_id"), // Changed to text and made nullable
action: text("action").notNull(), // This was missing!
details: jsonb("details").default(sql`'{}'::jsonb`), // This was missing!
level: text("level").notNull(),
timestamp: timestamp("timestamp", { withTimezone: true }).default(sql`now()`),
// Removed message field since logger doesn't use it
});