Skip to content

Future proof calendar/event data structure #1528

@yujonglee

Description

@yujonglee

Existing Resources

Reference

Need Edit

  • export const TABLE_EVENTS = "events";
    export const events = pgTable(TABLE_EVENTS, {
    ...SHARED,
    calendar_id: uuid("calendar_id").notNull().references(() => calendars.id, { onDelete: "cascade" }),
    title: text("title").notNull(),
    started_at: timestamp("started_at").notNull(),
    ended_at: timestamp("ended_at").notNull(),
    });
    export const TABLE_CALENDARS = "calendars";
    export const calendars = pgTable(TABLE_CALENDARS, {
    ...SHARED,
    name: text("name").notNull(),
    });
  • calendars: {
    user_id: { type: "string" },
    created_at: { type: "string" },
    name: { type: "string" },
    } satisfies InferTinyBaseSchema<typeof calendarSchema>,
    events: {
    user_id: { type: "string" },
    created_at: { type: "string" },
    calendar_id: { type: "string" },
    title: { type: "string" },
    started_at: { type: "string" },
    ended_at: { type: "string" },
    } satisfies InferTinyBaseSchema<typeof eventSchema>,

External Resources

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions