Add notes module
This commit is contained in:
@@ -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),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user