1import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";
2
3export const Notes = pgTable("notes", {
4 id: serial("id").primaryKey(),
5 body: text("body").notNull(),
6 createdAt: timestamp("created_at", { withTimezone: true })
7 .notNull()
8 .defaultNow(),
9});
10
11export type Note = typeof Notes.$inferSelect;
12
13export const ENSURE_NOTES_SQL = `
14CREATE TABLE IF NOT EXISTS notes (
15 id serial PRIMARY KEY,
16 body text NOT NULL,
17 created_at timestamptz NOT NULL DEFAULT now()
18)
19`;