Add notes module

This commit is contained in:
ginnoir
2026-05-06 04:10:50 -05:00
parent 016d01cc25
commit 5b434702ba
19 changed files with 775 additions and 24 deletions
+21
View File
@@ -1,11 +1,13 @@
import type { AdapterAccountType } from "@auth/core/adapters";
import {
index,
integer,
pgEnum,
pgTable,
primaryKey,
text,
timestamp,
uniqueIndex,
uuid,
varchar,
} from "drizzle-orm/pg-core";
@@ -82,3 +84,22 @@ export const householdMembers = pgTable(
},
(t) => [primaryKey({ columns: [t.householdId, t.userId] })],
);
export const reminders = pgTable(
"reminders",
{
id: uuid("id").primaryKey().defaultRandom(),
householdId: uuid("household_id")
.notNull()
.references(() => households.id, { onDelete: "cascade" }),
entityType: text("entity_type").notNull(),
entityId: uuid("entity_id").notNull(),
fireAt: timestamp("fire_at", { withTimezone: true }).notNull(),
channel: text("channel").notNull().default("in_app"),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
},
(t) => [
uniqueIndex("reminders_entity_unique").on(t.entityType, t.entityId),
index("reminders_household_fire_at_idx").on(t.householdId, t.fireAt),
],
);