+ {/* Header with day names */}
+
+ {/* Time gutter spacer */}
+
+
+ {/* Day columns header */}
+ {weekDays.map((day) => {
+ const isTodayDate = isToday(day);
+ const dayAllDayEvents = allDayEvents.filter((e) => {
+ const start = new Date(e.startAt);
+ const end = new Date(e.endAt);
+ return day >= start && day <= end;
+ });
+ const dayTasks = getTasksForDay(tasks, day);
+
+ return (
+
+ {/* Day header */}
+
+
+ {/* All-day events section */}
+ {(dayAllDayEvents.length > 0 || dayTasks.length > 0) && (
+
+ {dayAllDayEvents.map((event) => (
+
handlers.onEventClick(event)}
+ />
+ ))}
+ {dayTasks.map((task) => (
+ handlers.onTaskClick?.(task)}
+ />
+ ))}
+
+ )}
+
+ );
+ })}
+
+
+ {/* Time grid */}
+
+
+ {/* Time gutter */}
+
+ {HOURS.map((hour) => (
+
+
+ {format(setHours(new Date(), hour), 'h a')}
+
+
+ ))}
+
+
+ {/* Day columns */}
+ {weekDays.map((day) => {
+ const dayTimedEvents = timedEvents.filter((e) => {
+ const start = new Date(e.startAt);
+ const end = new Date(e.endAt);
+ return isSameDay(start, day) || isSameDay(end, day) || (start < day && end > day);
+ });
+
+ return (
+
+ {/* Hour slots */}
+ {HOURS.map((hour) => (
+
handleTimeSlotClick(day, hour)}
+ />
+ ))}
+
+ {/* Current time indicator */}
+ {isToday(day) &&
}
+
+ {/* Timed events */}
+ {dayTimedEvents.map((event) => {
+ const { top, height } = getEventStyle(event, day);
+ const colors = getEventColors(event.color);
+
+ return (
+
+ );
+ })}
+
+ );
+ })}
+
+
+
+ );
+}
+
+// Current time indicator
+function CurrentTimeIndicator() {
+ const now = new Date();
+ const minutes = now.getHours() * 60 + now.getMinutes();
+ const top = (minutes / 60) * HOUR_HEIGHT;
+
+ return (
+
+ );
+}
+
+// All-day event pill
+function AllDayEventPill({
+ event,
+ onClick,
+}: {
+ event: CalendarEvent;
+ onClick: () => void;
+}) {
+ const colors = getEventColors(event.color);
+
+ return (
+
+ );
+}
+
+// Task pill (muted styling)
+function TaskPill({
+ task,
+ onClick,
+}: {
+ task: TaskWithDueDate;
+ onClick: () => void;
+}) {
+ const isCompleted = task.status === 'completed';
+
+ return (
+
+ );
+}
diff --git a/apps/web/src/components/calendar/calendar-types.ts b/apps/web/src/components/calendar/calendar-types.ts
new file mode 100644
index 000000000..09effac7e
--- /dev/null
+++ b/apps/web/src/components/calendar/calendar-types.ts
@@ -0,0 +1,210 @@
+/**
+ * Calendar component types and configurations
+ */
+
+export type CalendarViewMode = 'month' | 'week' | 'day' | 'agenda';
+
+export type EventVisibility = 'DRIVE' | 'ATTENDEES_ONLY' | 'PRIVATE';
+export type AttendeeStatus = 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'TENTATIVE';
+
+export interface CalendarEventAttendee {
+ id: string;
+ eventId: string;
+ userId: string;
+ status: AttendeeStatus;
+ responseNote: string | null;
+ isOrganizer: boolean;
+ isOptional: boolean;
+ invitedAt: string;
+ respondedAt: string | null;
+ user: {
+ id: string;
+ name: string | null;
+ image: string | null;
+ };
+}
+
+export interface CalendarEvent {
+ id: string;
+ driveId: string | null;
+ createdById: string;
+ pageId: string | null;
+ title: string;
+ description: string | null;
+ location: string | null;
+ startAt: string;
+ endAt: string;
+ allDay: boolean;
+ timezone: string;
+ recurrenceRule: RecurrenceRule | null;
+ visibility: EventVisibility;
+ color: string;
+ createdAt: string;
+ updatedAt: string;
+ createdBy: {
+ id: string;
+ name: string | null;
+ image: string | null;
+ };
+ attendees: CalendarEventAttendee[];
+ page?: {
+ id: string;
+ title: string;
+ type: string;
+ } | null;
+ drive?: {
+ id: string;
+ name: string;
+ slug: string;
+ } | null;
+}
+
+export interface RecurrenceRule {
+ frequency: 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY';
+ interval: number;
+ byDay?: ('MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'SU')[];
+ byMonthDay?: number[];
+ byMonth?: number[];
+ count?: number;
+ until?: string;
+}
+
+export interface TaskWithDueDate {
+ id: string;
+ title: string;
+ dueDate: string;
+ status: 'pending' | 'in_progress' | 'completed' | 'blocked';
+ priority: 'low' | 'medium' | 'high';
+ taskListPageId: string;
+ driveId: string;
+}
+
+// Event color configurations
+export const EVENT_COLORS = {
+ default: {
+ bg: 'bg-primary/10',
+ border: 'border-l-primary',
+ text: 'text-primary',
+ dot: 'bg-primary',
+ },
+ meeting: {
+ bg: 'bg-purple-500/10',
+ border: 'border-l-purple-500',
+ text: 'text-purple-600',
+ dot: 'bg-purple-500',
+ },
+ deadline: {
+ bg: 'bg-red-500/10',
+ border: 'border-l-red-500',
+ text: 'text-red-600',
+ dot: 'bg-red-500',
+ },
+ personal: {
+ bg: 'bg-green-500/10',
+ border: 'border-l-green-500',
+ text: 'text-green-600',
+ dot: 'bg-green-500',
+ },
+ travel: {
+ bg: 'bg-amber-500/10',
+ border: 'border-l-amber-500',
+ text: 'text-amber-600',
+ dot: 'bg-amber-500',
+ },
+ focus: {
+ bg: 'bg-slate-500/10',
+ border: 'border-l-slate-500',
+ text: 'text-slate-600',
+ dot: 'bg-slate-500',
+ },
+} as const;
+
+// Task overlay styling (muted compared to events)
+export const TASK_OVERLAY_STYLE = {
+ bg: 'bg-muted/30',
+ border: 'border-l-muted-foreground/50 border-dashed',
+ text: 'text-muted-foreground italic',
+ opacity: 'opacity-70',
+};
+
+// Attendee status configurations
+export const ATTENDEE_STATUS_CONFIG = {
+ PENDING: { label: 'Pending', color: 'bg-muted text-muted-foreground' },
+ ACCEPTED: { label: 'Accepted', color: 'bg-green-100 text-green-700' },
+ DECLINED: { label: 'Declined', color: 'bg-red-100 text-red-700' },
+ TENTATIVE: { label: 'Maybe', color: 'bg-amber-100 text-amber-700' },
+} as const;
+
+// Calendar view handlers
+export interface CalendarHandlers {
+ onEventClick: (event: CalendarEvent) => void;
+ onEventCreate: (start: Date, end: Date, allDay?: boolean) => void;
+ onEventUpdate: (eventId: string, updates: Partial
) => void;
+ onEventDelete: (eventId: string) => void;
+ onTaskClick?: (task: TaskWithDueDate) => void;
+ onDateChange: (date: Date) => void;
+ onViewChange: (view: CalendarViewMode) => void;
+}
+
+// Helper to get event colors
+export function getEventColors(color: string) {
+ return EVENT_COLORS[color as keyof typeof EVENT_COLORS] ?? EVENT_COLORS.default;
+}
+
+// Helper to check if date is today
+export function isToday(date: Date): boolean {
+ const today = new Date();
+ return (
+ date.getDate() === today.getDate() &&
+ date.getMonth() === today.getMonth() &&
+ date.getFullYear() === today.getFullYear()
+ );
+}
+
+// Helper to check if two dates are the same day
+export function isSameDay(date1: Date, date2: Date): boolean {
+ return (
+ date1.getDate() === date2.getDate() &&
+ date1.getMonth() === date2.getMonth() &&
+ date1.getFullYear() === date2.getFullYear()
+ );
+}
+
+// Helper to get events for a specific day
+export function getEventsForDay(events: CalendarEvent[], date: Date): CalendarEvent[] {
+ return events.filter((event) => {
+ const start = new Date(event.startAt);
+ const end = new Date(event.endAt);
+ const dayStart = new Date(date);
+ dayStart.setHours(0, 0, 0, 0);
+ const dayEnd = new Date(date);
+ dayEnd.setHours(23, 59, 59, 999);
+
+ // Event overlaps with this day
+ return start <= dayEnd && end >= dayStart;
+ });
+}
+
+// Helper to get tasks for a specific day
+export function getTasksForDay(tasks: TaskWithDueDate[], date: Date): TaskWithDueDate[] {
+ return tasks.filter((task) => {
+ const dueDate = new Date(task.dueDate);
+ return isSameDay(dueDate, date);
+ });
+}
+
+// Format time for display
+export function formatEventTime(date: Date, allDay: boolean): string {
+ if (allDay) return 'All day';
+ return date.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' });
+}
+
+// Get hour from date (0-23)
+export function getHour(date: Date): number {
+ return date.getHours();
+}
+
+// Get minutes from date (0-59)
+export function getMinutes(date: Date): number {
+ return date.getMinutes();
+}
diff --git a/apps/web/src/components/calendar/index.ts b/apps/web/src/components/calendar/index.ts
new file mode 100644
index 000000000..4b562853c
--- /dev/null
+++ b/apps/web/src/components/calendar/index.ts
@@ -0,0 +1,8 @@
+export { CalendarView } from './CalendarView';
+export { MonthView } from './MonthView';
+export { WeekView } from './WeekView';
+export { DayView } from './DayView';
+export { AgendaView } from './AgendaView';
+export { EventModal } from './EventModal';
+export { useCalendarData } from './useCalendarData';
+export * from './calendar-types';
diff --git a/apps/web/src/components/calendar/useCalendarData.ts b/apps/web/src/components/calendar/useCalendarData.ts
new file mode 100644
index 000000000..fcd3b32f1
--- /dev/null
+++ b/apps/web/src/components/calendar/useCalendarData.ts
@@ -0,0 +1,206 @@
+'use client';
+
+import { useRef, useCallback, useMemo } from 'react';
+import useSWR, { mutate } from 'swr';
+import { fetchWithAuth, post, patch, del } from '@/lib/auth/auth-fetch';
+import { useEditingStore } from '@/stores/useEditingStore';
+import { CalendarEvent, TaskWithDueDate } from './calendar-types';
+import {
+ startOfMonth,
+ endOfMonth,
+ startOfWeek,
+ endOfWeek,
+ addDays,
+ subDays,
+} from 'date-fns';
+
+interface UseCalendarDataOptions {
+ context: 'user' | 'drive';
+ driveId?: string;
+ currentDate: Date;
+ includePersonal?: boolean;
+ includeTasks?: boolean;
+}
+
+interface CalendarEventsResponse {
+ events: CalendarEvent[];
+}
+
+interface CalendarTasksResponse {
+ tasks: TaskWithDueDate[];
+}
+
+const fetcher = async (url: string) => {
+ const res = await fetchWithAuth(url);
+ if (!res.ok) throw new Error('Failed to fetch');
+ return res.json();
+};
+
+export function useCalendarData({
+ context,
+ driveId,
+ currentDate,
+ includePersonal = true,
+ includeTasks = true,
+}: UseCalendarDataOptions) {
+ const hasLoadedRef = useRef(false);
+ const isAnyActive = useEditingStore((state) => state.isAnyActive());
+
+ // Calculate date range for the current view (include buffer for multi-day events)
+ const dateRange = useMemo(() => {
+ const monthStart = startOfMonth(currentDate);
+ const monthEnd = endOfMonth(currentDate);
+ // Extend to include visible weeks
+ const startDate = subDays(startOfWeek(monthStart), 7);
+ const endDate = addDays(endOfWeek(monthEnd), 7);
+ return { startDate, endDate };
+ }, [currentDate]);
+
+ // Build events query URL
+ const eventsUrl = useMemo(() => {
+ const params = new URLSearchParams({
+ context,
+ startDate: dateRange.startDate.toISOString(),
+ endDate: dateRange.endDate.toISOString(),
+ includePersonal: String(includePersonal),
+ });
+ if (driveId) {
+ params.set('driveId', driveId);
+ }
+ return `/api/calendar/events?${params.toString()}`;
+ }, [context, driveId, dateRange, includePersonal]);
+
+ // Fetch events
+ const {
+ data: eventsData,
+ error: eventsError,
+ isLoading: eventsLoading,
+ } = useSWR(eventsUrl, fetcher, {
+ revalidateOnFocus: false,
+ isPaused: () => hasLoadedRef.current && isAnyActive,
+ onSuccess: () => {
+ hasLoadedRef.current = true;
+ },
+ refreshInterval: 60000, // Refresh every minute
+ });
+
+ // Build tasks query URL (only fetch if includeTasks is true)
+ const tasksUrl = useMemo(() => {
+ if (!includeTasks) return null;
+ const params = new URLSearchParams({
+ context,
+ startDate: dateRange.startDate.toISOString(),
+ endDate: dateRange.endDate.toISOString(),
+ });
+ if (driveId) {
+ params.set('driveId', driveId);
+ }
+ return `/api/tasks?${params.toString()}`;
+ }, [context, driveId, dateRange, includeTasks]);
+
+ // Fetch tasks with due dates
+ const { data: tasksData } = useSWR(
+ tasksUrl,
+ tasksUrl ? fetcher : null,
+ {
+ revalidateOnFocus: false,
+ isPaused: () => hasLoadedRef.current && isAnyActive,
+ refreshInterval: 60000,
+ }
+ );
+
+ // Create event - post() returns parsed JSON directly, throws on error
+ const createEvent = useCallback(
+ async (eventData: {
+ title: string;
+ description?: string;
+ location?: string;
+ startAt: Date;
+ endAt: Date;
+ allDay?: boolean;
+ timezone?: string;
+ visibility?: 'DRIVE' | 'ATTENDEES_ONLY' | 'PRIVATE';
+ color?: string;
+ attendeeIds?: string[];
+ pageId?: string;
+ }) => {
+ const result = await post('/api/calendar/events', {
+ driveId: context === 'drive' ? driveId : null,
+ ...eventData,
+ startAt: eventData.startAt.toISOString(),
+ endAt: eventData.endAt.toISOString(),
+ });
+
+ // Revalidate events
+ mutate(eventsUrl);
+ return result;
+ },
+ [context, driveId, eventsUrl]
+ );
+
+ // Update event - patch() returns parsed JSON directly, throws on error
+ const updateEvent = useCallback(
+ async (eventId: string, updates: Partial> & { startAt?: Date | string; endAt?: Date | string }) => {
+ const result = await patch(`/api/calendar/events/${eventId}`, {
+ ...updates,
+ startAt: updates.startAt ? (updates.startAt instanceof Date ? updates.startAt.toISOString() : updates.startAt) : undefined,
+ endAt: updates.endAt ? (updates.endAt instanceof Date ? updates.endAt.toISOString() : updates.endAt) : undefined,
+ });
+
+ // Revalidate events
+ mutate(eventsUrl);
+ return result;
+ },
+ [eventsUrl]
+ );
+
+ // Delete event - del() throws on error
+ const deleteEvent = useCallback(
+ async (eventId: string) => {
+ await del(`/api/calendar/events/${eventId}`);
+
+ // Revalidate events
+ mutate(eventsUrl);
+ },
+ [eventsUrl]
+ );
+
+ // Update RSVP - patch() returns parsed JSON directly, throws on error
+ const updateRsvp = useCallback(
+ async (
+ eventId: string,
+ status: 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'TENTATIVE',
+ responseNote?: string
+ ) => {
+ const result = await patch(`/api/calendar/events/${eventId}/attendees`, {
+ status,
+ responseNote,
+ });
+
+ // Revalidate events
+ mutate(eventsUrl);
+ return result;
+ },
+ [eventsUrl]
+ );
+
+ // Refresh data
+ const refresh = useCallback(() => {
+ mutate(eventsUrl);
+ if (tasksUrl) {
+ mutate(tasksUrl);
+ }
+ }, [eventsUrl, tasksUrl]);
+
+ return {
+ events: eventsData?.events ?? [],
+ tasks: tasksData?.tasks ?? [],
+ isLoading: eventsLoading,
+ error: eventsError,
+ createEvent,
+ updateEvent,
+ deleteEvent,
+ updateRsvp,
+ refresh,
+ };
+}
diff --git a/apps/web/src/components/ui/toggle.tsx b/apps/web/src/components/ui/toggle.tsx
new file mode 100644
index 000000000..38f59a15a
--- /dev/null
+++ b/apps/web/src/components/ui/toggle.tsx
@@ -0,0 +1,47 @@
+"use client"
+
+import * as React from "react"
+import { cva, type VariantProps } from "class-variance-authority"
+import * as TogglePrimitive from "@radix-ui/react-toggle"
+
+import { cn } from "@/lib/utils/index"
+
+const toggleVariants = cva(
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
+ {
+ variants: {
+ variant: {
+ default: "bg-transparent",
+ outline:
+ "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
+ },
+ size: {
+ default: "h-9 px-2 min-w-9",
+ sm: "h-8 px-1.5 min-w-8",
+ lg: "h-10 px-2.5 min-w-10",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ size: "default",
+ },
+ }
+)
+
+function Toggle({
+ className,
+ variant,
+ size,
+ ...props
+}: React.ComponentProps &
+ VariantProps) {
+ return (
+
+ )
+}
+
+export { Toggle, toggleVariants }
diff --git a/apps/web/src/lib/websocket/calendar-events.ts b/apps/web/src/lib/websocket/calendar-events.ts
new file mode 100644
index 000000000..9d3b3af50
--- /dev/null
+++ b/apps/web/src/lib/websocket/calendar-events.ts
@@ -0,0 +1,129 @@
+/**
+ * Socket.IO utilities for broadcasting calendar events
+ */
+
+import { createSignedBroadcastHeaders } from '@pagespace/lib/broadcast-auth';
+import { browserLoggers } from '@pagespace/lib/logger-browser';
+import { isNodeEnvironment } from '@pagespace/lib/utils/environment';
+import { maskIdentifier } from '@/lib/logging/mask';
+
+const loggers = browserLoggers;
+
+export type CalendarOperation = 'created' | 'updated' | 'deleted' | 'rsvp_updated';
+
+export interface CalendarEventPayload {
+ eventId: string;
+ driveId: string | null;
+ operation: CalendarOperation;
+ userId: string; // User who triggered this event
+ attendeeIds: string[]; // Users who should be notified
+}
+
+const realtimeLogger = loggers.realtime.child({ module: 'calendar-events' });
+
+// Safely access environment variables
+const getEnvVar = (name: string, fallback = '') => {
+ if (isNodeEnvironment()) {
+ return process.env[name] || fallback;
+ }
+ return fallback;
+};
+
+const verboseRealtimeLogging = getEnvVar('NODE_ENV') !== 'production';
+
+/**
+ * Broadcasts a calendar event to the realtime server
+ *
+ * Calendar events are broadcast to:
+ * 1. Drive channel (if driveId is set) - for drive members viewing the drive calendar
+ * 2. Individual user channels - for attendees viewing their personal calendar
+ *
+ * @param payload - The calendar event payload to broadcast
+ */
+export async function broadcastCalendarEvent(payload: CalendarEventPayload): Promise {
+ const realtimeUrl = getEnvVar('INTERNAL_REALTIME_URL');
+ if (!realtimeUrl) {
+ realtimeLogger.warn('Realtime URL not configured, skipping calendar event broadcast', {
+ event: 'calendar',
+ eventId: maskIdentifier(payload.eventId),
+ });
+ return;
+ }
+
+ try {
+ // Broadcast to drive channel if this is a drive event
+ if (payload.driveId) {
+ const driveRequestBody = JSON.stringify({
+ channelId: `drive:${payload.driveId}:calendar`,
+ event: `calendar:${payload.operation}`,
+ payload,
+ });
+
+ await fetch(`${realtimeUrl}/api/broadcast`, {
+ method: 'POST',
+ headers: createSignedBroadcastHeaders(driveRequestBody),
+ body: driveRequestBody,
+ });
+
+ if (verboseRealtimeLogging) {
+ realtimeLogger.debug('Calendar event broadcasted to drive', {
+ operation: payload.operation,
+ driveId: maskIdentifier(payload.driveId),
+ eventId: maskIdentifier(payload.eventId),
+ });
+ }
+ }
+
+ // Broadcast to individual attendee channels (for personal calendar views)
+ for (const attendeeId of payload.attendeeIds) {
+ const userRequestBody = JSON.stringify({
+ channelId: `user:${attendeeId}:calendar`,
+ event: `calendar:${payload.operation}`,
+ payload,
+ });
+
+ await fetch(`${realtimeUrl}/api/broadcast`, {
+ method: 'POST',
+ headers: createSignedBroadcastHeaders(userRequestBody),
+ body: userRequestBody,
+ });
+ }
+
+ if (verboseRealtimeLogging) {
+ realtimeLogger.debug('Calendar event broadcasted to attendees', {
+ operation: payload.operation,
+ eventId: maskIdentifier(payload.eventId),
+ attendeeCount: payload.attendeeIds.length,
+ });
+ }
+ } catch (error) {
+ realtimeLogger.error(
+ 'Failed to broadcast calendar event',
+ error instanceof Error ? error : undefined,
+ {
+ event: 'calendar',
+ operation: payload.operation,
+ eventId: maskIdentifier(payload.eventId),
+ }
+ );
+ }
+}
+
+/**
+ * Helper to create a calendar event payload
+ */
+export function createCalendarEventPayload(
+ eventId: string,
+ driveId: string | null,
+ operation: CalendarOperation,
+ userId: string,
+ attendeeIds: string[]
+): CalendarEventPayload {
+ return {
+ eventId,
+ driveId,
+ operation,
+ userId,
+ attendeeIds,
+ };
+}
diff --git a/apps/web/src/lib/websocket/index.ts b/apps/web/src/lib/websocket/index.ts
index 9a2d63dd2..c827e7fe2 100644
--- a/apps/web/src/lib/websocket/index.ts
+++ b/apps/web/src/lib/websocket/index.ts
@@ -7,3 +7,4 @@ export * from './socket-utils';
export * from './ws-connections';
export * from './ws-message-schemas';
export * from './ws-security';
+export * from './calendar-events';
diff --git a/packages/db/drizzle/0064_curious_tigra.sql b/packages/db/drizzle/0064_curious_tigra.sql
new file mode 100644
index 000000000..134e57477
--- /dev/null
+++ b/packages/db/drizzle/0064_curious_tigra.sql
@@ -0,0 +1,98 @@
+DO $$ BEGIN
+ CREATE TYPE "public"."AttendeeStatus" AS ENUM('PENDING', 'ACCEPTED', 'DECLINED', 'TENTATIVE');
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ CREATE TYPE "public"."EventVisibility" AS ENUM('DRIVE', 'ATTENDEES_ONLY', 'PRIVATE');
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ CREATE TYPE "public"."RecurrenceFrequency" AS ENUM('DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY');
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "calendar_events" (
+ "id" text PRIMARY KEY NOT NULL,
+ "driveId" text,
+ "createdById" text NOT NULL,
+ "pageId" text,
+ "title" text NOT NULL,
+ "description" text,
+ "location" text,
+ "startAt" timestamp with time zone NOT NULL,
+ "endAt" timestamp with time zone NOT NULL,
+ "allDay" boolean DEFAULT false NOT NULL,
+ "timezone" text DEFAULT 'UTC' NOT NULL,
+ "recurrenceRule" jsonb,
+ "recurrenceExceptions" jsonb DEFAULT '[]'::jsonb,
+ "recurringEventId" text,
+ "originalStartAt" timestamp with time zone,
+ "visibility" "EventVisibility" DEFAULT 'DRIVE' NOT NULL,
+ "color" text DEFAULT 'default',
+ "metadata" jsonb,
+ "isTrashed" boolean DEFAULT false NOT NULL,
+ "trashedAt" timestamp,
+ "createdAt" timestamp DEFAULT now() NOT NULL,
+ "updatedAt" timestamp NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "event_attendees" (
+ "id" text PRIMARY KEY NOT NULL,
+ "eventId" text NOT NULL,
+ "userId" text NOT NULL,
+ "status" "AttendeeStatus" DEFAULT 'PENDING' NOT NULL,
+ "responseNote" text,
+ "isOrganizer" boolean DEFAULT false NOT NULL,
+ "isOptional" boolean DEFAULT false NOT NULL,
+ "invitedAt" timestamp DEFAULT now() NOT NULL,
+ "respondedAt" timestamp,
+ CONSTRAINT "event_attendees_event_user_key" UNIQUE("eventId","userId")
+);
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "calendar_events" ADD CONSTRAINT "calendar_events_driveId_drives_id_fk" FOREIGN KEY ("driveId") REFERENCES "public"."drives"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "calendar_events" ADD CONSTRAINT "calendar_events_createdById_users_id_fk" FOREIGN KEY ("createdById") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "calendar_events" ADD CONSTRAINT "calendar_events_pageId_pages_id_fk" FOREIGN KEY ("pageId") REFERENCES "public"."pages"("id") ON DELETE set null ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "event_attendees" ADD CONSTRAINT "event_attendees_eventId_calendar_events_id_fk" FOREIGN KEY ("eventId") REFERENCES "public"."calendar_events"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "event_attendees" ADD CONSTRAINT "event_attendees_userId_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "calendar_events_drive_id_idx" ON "calendar_events" USING btree ("driveId");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "calendar_events_created_by_id_idx" ON "calendar_events" USING btree ("createdById");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "calendar_events_page_id_idx" ON "calendar_events" USING btree ("pageId");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "calendar_events_start_at_idx" ON "calendar_events" USING btree ("startAt");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "calendar_events_end_at_idx" ON "calendar_events" USING btree ("endAt");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "calendar_events_drive_id_start_at_idx" ON "calendar_events" USING btree ("driveId","startAt");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "calendar_events_recurring_event_id_idx" ON "calendar_events" USING btree ("recurringEventId");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "calendar_events_is_trashed_idx" ON "calendar_events" USING btree ("isTrashed");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "event_attendees_event_id_idx" ON "event_attendees" USING btree ("eventId");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "event_attendees_user_id_idx" ON "event_attendees" USING btree ("userId");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "event_attendees_status_idx" ON "event_attendees" USING btree ("status");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "event_attendees_user_id_status_idx" ON "event_attendees" USING btree ("userId","status");
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0064_snapshot.json b/packages/db/drizzle/meta/0064_snapshot.json
new file mode 100644
index 000000000..4411aae7a
--- /dev/null
+++ b/packages/db/drizzle/meta/0064_snapshot.json
@@ -0,0 +1,11868 @@
+{
+ "id": "fc8fef71-9ec1-4e47-afcb-48fbe9db7d29",
+ "prevId": "46017e9a-99d6-4622-b846-d1ec84b94bdb",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.device_tokens": {
+ "name": "device_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tokenHash": {
+ "name": "tokenHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tokenPrefix": {
+ "name": "tokenPrefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "lastUsedAt": {
+ "name": "lastUsedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deviceId": {
+ "name": "deviceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "PlatformType",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deviceName": {
+ "name": "deviceName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tokenVersion": {
+ "name": "tokenVersion",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "userAgent": {
+ "name": "userAgent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ipAddress": {
+ "name": "ipAddress",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastIpAddress": {
+ "name": "lastIpAddress",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "location": {
+ "name": "location",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trustScore": {
+ "name": "trustScore",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "suspiciousActivityCount": {
+ "name": "suspiciousActivityCount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "revokedAt": {
+ "name": "revokedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revokedReason": {
+ "name": "revokedReason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "replacedByTokenId": {
+ "name": "replacedByTokenId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "device_tokens_user_id_idx": {
+ "name": "device_tokens_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "device_tokens_token_hash_idx": {
+ "name": "device_tokens_token_hash_idx",
+ "columns": [
+ {
+ "expression": "tokenHash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "device_tokens_device_id_idx": {
+ "name": "device_tokens_device_id_idx",
+ "columns": [
+ {
+ "expression": "deviceId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "device_tokens_expires_at_idx": {
+ "name": "device_tokens_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expiresAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "device_tokens_active_device_idx": {
+ "name": "device_tokens_active_device_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deviceId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"device_tokens\".\"revokedAt\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "device_tokens_userId_users_id_fk": {
+ "name": "device_tokens_userId_users_id_fk",
+ "tableFrom": "device_tokens",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "device_tokens_tokenHash_unique": {
+ "name": "device_tokens_tokenHash_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "tokenHash"
+ ]
+ }
+ }
+ },
+ "public.email_unsubscribe_tokens": {
+ "name": "email_unsubscribe_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_prefix": {
+ "name": "token_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "notification_type": {
+ "name": "notification_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "used_at": {
+ "name": "used_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "email_unsubscribe_tokens_token_hash_idx": {
+ "name": "email_unsubscribe_tokens_token_hash_idx",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "email_unsubscribe_tokens_user_id_idx": {
+ "name": "email_unsubscribe_tokens_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "email_unsubscribe_tokens_expires_at_idx": {
+ "name": "email_unsubscribe_tokens_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "email_unsubscribe_tokens_user_id_users_id_fk": {
+ "name": "email_unsubscribe_tokens_user_id_users_id_fk",
+ "tableFrom": "email_unsubscribe_tokens",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "email_unsubscribe_tokens_token_hash_unique": {
+ "name": "email_unsubscribe_tokens_token_hash_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token_hash"
+ ]
+ }
+ }
+ },
+ "public.mcp_tokens": {
+ "name": "mcp_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tokenHash": {
+ "name": "tokenHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tokenPrefix": {
+ "name": "tokenPrefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "lastUsed": {
+ "name": "lastUsed",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "revokedAt": {
+ "name": "revokedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "mcp_tokens_user_id_idx": {
+ "name": "mcp_tokens_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_tokens_token_hash_idx": {
+ "name": "mcp_tokens_token_hash_idx",
+ "columns": [
+ {
+ "expression": "tokenHash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_tokens_userId_users_id_fk": {
+ "name": "mcp_tokens_userId_users_id_fk",
+ "tableFrom": "mcp_tokens",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "mcp_tokens_tokenHash_unique": {
+ "name": "mcp_tokens_tokenHash_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "tokenHash"
+ ]
+ }
+ }
+ },
+ "public.socket_tokens": {
+ "name": "socket_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tokenHash": {
+ "name": "tokenHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "socket_tokens_user_id_idx": {
+ "name": "socket_tokens_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "socket_tokens_token_hash_idx": {
+ "name": "socket_tokens_token_hash_idx",
+ "columns": [
+ {
+ "expression": "tokenHash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "socket_tokens_expires_at_idx": {
+ "name": "socket_tokens_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expiresAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "socket_tokens_userId_users_id_fk": {
+ "name": "socket_tokens_userId_users_id_fk",
+ "tableFrom": "socket_tokens",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "socket_tokens_tokenHash_unique": {
+ "name": "socket_tokens_tokenHash_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "tokenHash"
+ ]
+ }
+ }
+ },
+ "public.users": {
+ "name": "users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "googleId": {
+ "name": "googleId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "appleId": {
+ "name": "appleId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "AuthProvider",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'email'"
+ },
+ "tokenVersion": {
+ "name": "tokenVersion",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "role": {
+ "name": "role",
+ "type": "UserRole",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'user'"
+ },
+ "adminRoleVersion": {
+ "name": "adminRoleVersion",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "currentAiProvider": {
+ "name": "currentAiProvider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pagespace'"
+ },
+ "currentAiModel": {
+ "name": "currentAiModel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'glm-4.5-air'"
+ },
+ "storageUsedBytes": {
+ "name": "storageUsedBytes",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "activeUploads": {
+ "name": "activeUploads",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lastStorageCalculated": {
+ "name": "lastStorageCalculated",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripeCustomerId": {
+ "name": "stripeCustomerId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subscriptionTier": {
+ "name": "subscriptionTier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'free'"
+ },
+ "tosAcceptedAt": {
+ "name": "tosAcceptedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failedLoginAttempts": {
+ "name": "failedLoginAttempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lockedUntil": {
+ "name": "lockedUntil",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspendedAt": {
+ "name": "suspendedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspendedReason": {
+ "name": "suspendedReason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "users_email_unique": {
+ "name": "users_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ },
+ "users_googleId_unique": {
+ "name": "users_googleId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "googleId"
+ ]
+ },
+ "users_appleId_unique": {
+ "name": "users_appleId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "appleId"
+ ]
+ },
+ "users_stripeCustomerId_unique": {
+ "name": "users_stripeCustomerId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripeCustomerId"
+ ]
+ }
+ }
+ },
+ "public.verification_tokens": {
+ "name": "verification_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tokenHash": {
+ "name": "tokenHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tokenPrefix": {
+ "name": "tokenPrefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "usedAt": {
+ "name": "usedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "verification_tokens_user_id_idx": {
+ "name": "verification_tokens_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "verification_tokens_token_hash_idx": {
+ "name": "verification_tokens_token_hash_idx",
+ "columns": [
+ {
+ "expression": "tokenHash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "verification_tokens_type_idx": {
+ "name": "verification_tokens_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "verification_tokens_userId_users_id_fk": {
+ "name": "verification_tokens_userId_users_id_fk",
+ "tableFrom": "verification_tokens",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "verification_tokens_tokenHash_unique": {
+ "name": "verification_tokens_tokenHash_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "tokenHash"
+ ]
+ }
+ }
+ },
+ "public.sessions": {
+ "name": "sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_prefix": {
+ "name": "token_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "ARRAY[]::text[]"
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "drive_id": {
+ "name": "drive_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_version": {
+ "name": "token_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_service": {
+ "name": "created_by_service",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_ip": {
+ "name": "created_by_ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_ip": {
+ "name": "last_used_ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_reason": {
+ "name": "revoked_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "sessions_user_id_idx": {
+ "name": "sessions_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sessions_expires_at_idx": {
+ "name": "sessions_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sessions_user_active_idx": {
+ "name": "sessions_user_active_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revoked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "sessions_user_id_users_id_fk": {
+ "name": "sessions_user_id_users_id_fk",
+ "tableFrom": "sessions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "sessions_token_hash_unique": {
+ "name": "sessions_token_hash_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token_hash"
+ ]
+ }
+ }
+ },
+ "public.chat_messages": {
+ "name": "chat_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversationId": {
+ "name": "conversationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "toolCalls": {
+ "name": "toolCalls",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "toolResults": {
+ "name": "toolResults",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "isActive": {
+ "name": "isActive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "editedAt": {
+ "name": "editedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sourceAgentId": {
+ "name": "sourceAgentId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "messageType": {
+ "name": "messageType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'standard'"
+ }
+ },
+ "indexes": {
+ "chat_messages_page_id_idx": {
+ "name": "chat_messages_page_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "chat_messages_user_id_idx": {
+ "name": "chat_messages_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "chat_messages_conversation_id_idx": {
+ "name": "chat_messages_conversation_id_idx",
+ "columns": [
+ {
+ "expression": "conversationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "chat_messages_page_id_conversation_id_idx": {
+ "name": "chat_messages_page_id_conversation_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "conversationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "chat_messages_page_id_is_active_created_at_idx": {
+ "name": "chat_messages_page_id_is_active_created_at_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "isActive",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "chat_messages_pageId_pages_id_fk": {
+ "name": "chat_messages_pageId_pages_id_fk",
+ "tableFrom": "chat_messages",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "chat_messages_userId_users_id_fk": {
+ "name": "chat_messages_userId_users_id_fk",
+ "tableFrom": "chat_messages",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "chat_messages_sourceAgentId_pages_id_fk": {
+ "name": "chat_messages_sourceAgentId_pages_id_fk",
+ "tableFrom": "chat_messages",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "sourceAgentId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.drives": {
+ "name": "drives",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "isTrashed": {
+ "name": "isTrashed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trashedAt": {
+ "name": "trashedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "drivePrompt": {
+ "name": "drivePrompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "drives_owner_id_idx": {
+ "name": "drives_owner_id_idx",
+ "columns": [
+ {
+ "expression": "ownerId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "drives_owner_id_slug_key": {
+ "name": "drives_owner_id_slug_key",
+ "columns": [
+ {
+ "expression": "ownerId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drives_ownerId_users_id_fk": {
+ "name": "drives_ownerId_users_id_fk",
+ "tableFrom": "drives",
+ "tableTo": "users",
+ "columnsFrom": [
+ "ownerId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.favorites": {
+ "name": "favorites",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "itemType": {
+ "name": "itemType",
+ "type": "FavoriteItemType",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'page'"
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "favorites_user_id_page_id_key": {
+ "name": "favorites_user_id_page_id_key",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "favorites_user_id_drive_id_key": {
+ "name": "favorites_user_id_drive_id_key",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "favorites_user_id_position_idx": {
+ "name": "favorites_user_id_position_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "favorites_userId_users_id_fk": {
+ "name": "favorites_userId_users_id_fk",
+ "tableFrom": "favorites",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "favorites_pageId_pages_id_fk": {
+ "name": "favorites_pageId_pages_id_fk",
+ "tableFrom": "favorites",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "favorites_driveId_drives_id_fk": {
+ "name": "favorites_driveId_drives_id_fk",
+ "tableFrom": "favorites",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.mentions": {
+ "name": "mentions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "sourcePageId": {
+ "name": "sourcePageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "targetPageId": {
+ "name": "targetPageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "mentions_source_page_id_target_page_id_key": {
+ "name": "mentions_source_page_id_target_page_id_key",
+ "columns": [
+ {
+ "expression": "sourcePageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "targetPageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mentions_source_page_id_idx": {
+ "name": "mentions_source_page_id_idx",
+ "columns": [
+ {
+ "expression": "sourcePageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mentions_target_page_id_idx": {
+ "name": "mentions_target_page_id_idx",
+ "columns": [
+ {
+ "expression": "targetPageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mentions_sourcePageId_pages_id_fk": {
+ "name": "mentions_sourcePageId_pages_id_fk",
+ "tableFrom": "mentions",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "sourcePageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mentions_targetPageId_pages_id_fk": {
+ "name": "mentions_targetPageId_pages_id_fk",
+ "tableFrom": "mentions",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "targetPageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.page_tags": {
+ "name": "page_tags",
+ "schema": "",
+ "columns": {
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tagId": {
+ "name": "tagId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "page_tags_pageId_pages_id_fk": {
+ "name": "page_tags_pageId_pages_id_fk",
+ "tableFrom": "page_tags",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_tags_tagId_tags_id_fk": {
+ "name": "page_tags_tagId_tags_id_fk",
+ "tableFrom": "page_tags",
+ "tableTo": "tags",
+ "columnsFrom": [
+ "tagId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "page_tags_pageId_tagId_pk": {
+ "name": "page_tags_pageId_tagId_pk",
+ "columns": [
+ "pageId",
+ "tagId"
+ ]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.pages": {
+ "name": "pages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "PageType",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "isPaginated": {
+ "name": "isPaginated",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "isTrashed": {
+ "name": "isTrashed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "aiProvider": {
+ "name": "aiProvider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aiModel": {
+ "name": "aiModel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "systemPrompt": {
+ "name": "systemPrompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabledTools": {
+ "name": "enabledTools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "includeDrivePrompt": {
+ "name": "includeDrivePrompt",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "agentDefinition": {
+ "name": "agentDefinition",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "visibleToGlobalAssistant": {
+ "name": "visibleToGlobalAssistant",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "includePageTree": {
+ "name": "includePageTree",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "pageTreeScope": {
+ "name": "pageTreeScope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'children'"
+ },
+ "fileSize": {
+ "name": "fileSize",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mimeType": {
+ "name": "mimeType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "originalFileName": {
+ "name": "originalFileName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "filePath": {
+ "name": "filePath",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fileMetadata": {
+ "name": "fileMetadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processingStatus": {
+ "name": "processingStatus",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'pending'"
+ },
+ "processingError": {
+ "name": "processingError",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processedAt": {
+ "name": "processedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "extractionMethod": {
+ "name": "extractionMethod",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "extractionMetadata": {
+ "name": "extractionMetadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contentHash": {
+ "name": "contentHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trashedAt": {
+ "name": "trashedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "stateHash": {
+ "name": "stateHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parentId": {
+ "name": "parentId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "originalParentId": {
+ "name": "originalParentId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "pages_drive_id_idx": {
+ "name": "pages_drive_id_idx",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pages_parent_id_idx": {
+ "name": "pages_parent_id_idx",
+ "columns": [
+ {
+ "expression": "parentId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pages_parent_id_position_idx": {
+ "name": "pages_parent_id_position_idx",
+ "columns": [
+ {
+ "expression": "parentId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pages_driveId_drives_id_fk": {
+ "name": "pages_driveId_drives_id_fk",
+ "tableFrom": "pages",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.storage_events": {
+ "name": "storage_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "eventType": {
+ "name": "eventType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sizeDelta": {
+ "name": "sizeDelta",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "totalSizeAfter": {
+ "name": "totalSizeAfter",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "storage_events_user_id_idx": {
+ "name": "storage_events_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "storage_events_created_at_idx": {
+ "name": "storage_events_created_at_idx",
+ "columns": [
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "storage_events_userId_users_id_fk": {
+ "name": "storage_events_userId_users_id_fk",
+ "tableFrom": "storage_events",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "storage_events_pageId_pages_id_fk": {
+ "name": "storage_events_pageId_pages_id_fk",
+ "tableFrom": "storage_events",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.tags": {
+ "name": "tags",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "tags_name_unique": {
+ "name": "tags_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "name"
+ ]
+ }
+ }
+ },
+ "public.user_mentions": {
+ "name": "user_mentions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "sourcePageId": {
+ "name": "sourcePageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "targetUserId": {
+ "name": "targetUserId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mentionedByUserId": {
+ "name": "mentionedByUserId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "user_mentions_source_page_id_target_user_id_key": {
+ "name": "user_mentions_source_page_id_target_user_id_key",
+ "columns": [
+ {
+ "expression": "sourcePageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "targetUserId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_mentions_source_page_id_idx": {
+ "name": "user_mentions_source_page_id_idx",
+ "columns": [
+ {
+ "expression": "sourcePageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_mentions_target_user_id_idx": {
+ "name": "user_mentions_target_user_id_idx",
+ "columns": [
+ {
+ "expression": "targetUserId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_mentions_sourcePageId_pages_id_fk": {
+ "name": "user_mentions_sourcePageId_pages_id_fk",
+ "tableFrom": "user_mentions",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "sourcePageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_mentions_targetUserId_users_id_fk": {
+ "name": "user_mentions_targetUserId_users_id_fk",
+ "tableFrom": "user_mentions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "targetUserId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_mentions_mentionedByUserId_users_id_fk": {
+ "name": "user_mentions_mentionedByUserId_users_id_fk",
+ "tableFrom": "user_mentions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "mentionedByUserId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.permissions": {
+ "name": "permissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "PermissionAction",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subjectType": {
+ "name": "subjectType",
+ "type": "SubjectType",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subjectId": {
+ "name": "subjectId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "permissions_page_id_idx": {
+ "name": "permissions_page_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permissions_subject_id_subject_type_idx": {
+ "name": "permissions_subject_id_subject_type_idx",
+ "columns": [
+ {
+ "expression": "subjectId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subjectType",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permissions_page_id_subject_id_subject_type_idx": {
+ "name": "permissions_page_id_subject_id_subject_type_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subjectId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subjectType",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "permissions_pageId_pages_id_fk": {
+ "name": "permissions_pageId_pages_id_fk",
+ "tableFrom": "permissions",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.drive_invitations": {
+ "name": "drive_invitations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invitedBy": {
+ "name": "invitedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "InvitationStatus",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING'"
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "respondedAt": {
+ "name": "respondedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "drive_invitations_drive_id_idx": {
+ "name": "drive_invitations_drive_id_idx",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "drive_invitations_email_idx": {
+ "name": "drive_invitations_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "drive_invitations_status_idx": {
+ "name": "drive_invitations_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "drive_invitations_token_idx": {
+ "name": "drive_invitations_token_idx",
+ "columns": [
+ {
+ "expression": "token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drive_invitations_driveId_drives_id_fk": {
+ "name": "drive_invitations_driveId_drives_id_fk",
+ "tableFrom": "drive_invitations",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "drive_invitations_userId_users_id_fk": {
+ "name": "drive_invitations_userId_users_id_fk",
+ "tableFrom": "drive_invitations",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "drive_invitations_invitedBy_users_id_fk": {
+ "name": "drive_invitations_invitedBy_users_id_fk",
+ "tableFrom": "drive_invitations",
+ "tableTo": "users",
+ "columnsFrom": [
+ "invitedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "drive_invitations_token_unique": {
+ "name": "drive_invitations_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ }
+ },
+ "public.drive_members": {
+ "name": "drive_members",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "MemberRole",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'MEMBER'"
+ },
+ "customRoleId": {
+ "name": "customRoleId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invitedBy": {
+ "name": "invitedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invitedAt": {
+ "name": "invitedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "acceptedAt": {
+ "name": "acceptedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastAccessedAt": {
+ "name": "lastAccessedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "drive_members_drive_id_idx": {
+ "name": "drive_members_drive_id_idx",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "drive_members_user_id_idx": {
+ "name": "drive_members_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "drive_members_role_idx": {
+ "name": "drive_members_role_idx",
+ "columns": [
+ {
+ "expression": "role",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "drive_members_custom_role_id_idx": {
+ "name": "drive_members_custom_role_id_idx",
+ "columns": [
+ {
+ "expression": "customRoleId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drive_members_driveId_drives_id_fk": {
+ "name": "drive_members_driveId_drives_id_fk",
+ "tableFrom": "drive_members",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "drive_members_userId_users_id_fk": {
+ "name": "drive_members_userId_users_id_fk",
+ "tableFrom": "drive_members",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "drive_members_customRoleId_drive_roles_id_fk": {
+ "name": "drive_members_customRoleId_drive_roles_id_fk",
+ "tableFrom": "drive_members",
+ "tableTo": "drive_roles",
+ "columnsFrom": [
+ "customRoleId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "drive_members_invitedBy_users_id_fk": {
+ "name": "drive_members_invitedBy_users_id_fk",
+ "tableFrom": "drive_members",
+ "tableTo": "users",
+ "columnsFrom": [
+ "invitedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "drive_members_drive_user_key": {
+ "name": "drive_members_drive_user_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "driveId",
+ "userId"
+ ]
+ }
+ }
+ },
+ "public.drive_roles": {
+ "name": "drive_roles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isDefault": {
+ "name": "isDefault",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "drive_roles_drive_id_idx": {
+ "name": "drive_roles_drive_id_idx",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "drive_roles_position_idx": {
+ "name": "drive_roles_position_idx",
+ "columns": [
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drive_roles_driveId_drives_id_fk": {
+ "name": "drive_roles_driveId_drives_id_fk",
+ "tableFrom": "drive_roles",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "drive_roles_drive_name_key": {
+ "name": "drive_roles_drive_name_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "driveId",
+ "name"
+ ]
+ }
+ }
+ },
+ "public.page_permissions": {
+ "name": "page_permissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canView": {
+ "name": "canView",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "canEdit": {
+ "name": "canEdit",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "canShare": {
+ "name": "canShare",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "canDelete": {
+ "name": "canDelete",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "grantedBy": {
+ "name": "grantedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grantedAt": {
+ "name": "grantedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "page_permissions_page_id_idx": {
+ "name": "page_permissions_page_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "page_permissions_user_id_idx": {
+ "name": "page_permissions_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "page_permissions_expires_at_idx": {
+ "name": "page_permissions_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expiresAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "page_permissions_pageId_pages_id_fk": {
+ "name": "page_permissions_pageId_pages_id_fk",
+ "tableFrom": "page_permissions",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_permissions_userId_users_id_fk": {
+ "name": "page_permissions_userId_users_id_fk",
+ "tableFrom": "page_permissions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_permissions_grantedBy_users_id_fk": {
+ "name": "page_permissions_grantedBy_users_id_fk",
+ "tableFrom": "page_permissions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "grantedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "page_permissions_page_user_key": {
+ "name": "page_permissions_page_user_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "pageId",
+ "userId"
+ ]
+ }
+ }
+ },
+ "public.user_profiles": {
+ "name": "user_profiles",
+ "schema": "",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "displayName": {
+ "name": "displayName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bio": {
+ "name": "bio",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "avatarUrl": {
+ "name": "avatarUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isPublic": {
+ "name": "isPublic",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "user_profiles_is_public_idx": {
+ "name": "user_profiles_is_public_idx",
+ "columns": [
+ {
+ "expression": "isPublic",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_profiles_userId_users_id_fk": {
+ "name": "user_profiles_userId_users_id_fk",
+ "tableFrom": "user_profiles",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.channel_message_reactions": {
+ "name": "channel_message_reactions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "messageId": {
+ "name": "messageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "emoji": {
+ "name": "emoji",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_reaction_idx": {
+ "name": "unique_reaction_idx",
+ "columns": [
+ {
+ "expression": "messageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "emoji",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "reaction_message_idx": {
+ "name": "reaction_message_idx",
+ "columns": [
+ {
+ "expression": "messageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "channel_message_reactions_messageId_channel_messages_id_fk": {
+ "name": "channel_message_reactions_messageId_channel_messages_id_fk",
+ "tableFrom": "channel_message_reactions",
+ "tableTo": "channel_messages",
+ "columnsFrom": [
+ "messageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "channel_message_reactions_userId_users_id_fk": {
+ "name": "channel_message_reactions_userId_users_id_fk",
+ "tableFrom": "channel_message_reactions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.channel_messages": {
+ "name": "channel_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "fileId": {
+ "name": "fileId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attachmentMeta": {
+ "name": "attachmentMeta",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "channel_messages_page_id_idx": {
+ "name": "channel_messages_page_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "channel_messages_file_id_idx": {
+ "name": "channel_messages_file_id_idx",
+ "columns": [
+ {
+ "expression": "fileId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "channel_messages_pageId_pages_id_fk": {
+ "name": "channel_messages_pageId_pages_id_fk",
+ "tableFrom": "channel_messages",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "channel_messages_userId_users_id_fk": {
+ "name": "channel_messages_userId_users_id_fk",
+ "tableFrom": "channel_messages",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "channel_messages_fileId_files_id_fk": {
+ "name": "channel_messages_fileId_files_id_fk",
+ "tableFrom": "channel_messages",
+ "tableTo": "files",
+ "columnsFrom": [
+ "fileId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.channel_read_status": {
+ "name": "channel_read_status",
+ "schema": "",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channelId": {
+ "name": "channelId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "lastReadAt": {
+ "name": "lastReadAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "channel_read_status_user_id_idx": {
+ "name": "channel_read_status_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "channel_read_status_channel_id_idx": {
+ "name": "channel_read_status_channel_id_idx",
+ "columns": [
+ {
+ "expression": "channelId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "channel_read_status_userId_users_id_fk": {
+ "name": "channel_read_status_userId_users_id_fk",
+ "tableFrom": "channel_read_status",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "channel_read_status_channelId_pages_id_fk": {
+ "name": "channel_read_status_channelId_pages_id_fk",
+ "tableFrom": "channel_read_status",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "channelId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "channel_read_status_userId_channelId_pk": {
+ "name": "channel_read_status_userId_channelId_pk",
+ "columns": [
+ "userId",
+ "channelId"
+ ]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.user_ai_settings": {
+ "name": "user_ai_settings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encryptedApiKey": {
+ "name": "encryptedApiKey",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "baseUrl": {
+ "name": "baseUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_ai_settings_userId_users_id_fk": {
+ "name": "user_ai_settings_userId_users_id_fk",
+ "tableFrom": "user_ai_settings",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_provider_unique": {
+ "name": "user_provider_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "userId",
+ "provider"
+ ]
+ }
+ }
+ },
+ "public.pulse_summaries": {
+ "name": "pulse_summaries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "greeting": {
+ "name": "greeting",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "pulse_summary_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'scheduled'"
+ },
+ "contextData": {
+ "name": "contextData",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aiProvider": {
+ "name": "aiProvider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aiModel": {
+ "name": "aiModel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "periodStart": {
+ "name": "periodStart",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "periodEnd": {
+ "name": "periodEnd",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "generatedAt": {
+ "name": "generatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "idx_pulse_summaries_user_id": {
+ "name": "idx_pulse_summaries_user_id",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_pulse_summaries_generated_at": {
+ "name": "idx_pulse_summaries_generated_at",
+ "columns": [
+ {
+ "expression": "generatedAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_pulse_summaries_expires_at": {
+ "name": "idx_pulse_summaries_expires_at",
+ "columns": [
+ {
+ "expression": "expiresAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_pulse_summaries_user_generated": {
+ "name": "idx_pulse_summaries_user_generated",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "generatedAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pulse_summaries_userId_users_id_fk": {
+ "name": "pulse_summaries_userId_users_id_fk",
+ "tableFrom": "pulse_summaries",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.user_dashboards": {
+ "name": "user_dashboards",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_dashboards_userId_users_id_fk": {
+ "name": "user_dashboards_userId_users_id_fk",
+ "tableFrom": "user_dashboards",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_dashboards_userId_unique": {
+ "name": "user_dashboards_userId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "userId"
+ ]
+ }
+ }
+ },
+ "public.conversations": {
+ "name": "conversations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contextId": {
+ "name": "contextId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastMessageAt": {
+ "name": "lastMessageAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "isActive": {
+ "name": "isActive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ }
+ },
+ "indexes": {
+ "conversations_user_id_idx": {
+ "name": "conversations_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "conversations_user_id_type_idx": {
+ "name": "conversations_user_id_type_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "conversations_user_id_last_message_at_idx": {
+ "name": "conversations_user_id_last_message_at_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lastMessageAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "conversations_context_id_idx": {
+ "name": "conversations_context_id_idx",
+ "columns": [
+ {
+ "expression": "contextId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "conversations_userId_users_id_fk": {
+ "name": "conversations_userId_users_id_fk",
+ "tableFrom": "conversations",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.messages": {
+ "name": "messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "conversationId": {
+ "name": "conversationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "messageType": {
+ "name": "messageType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'standard'"
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "toolCalls": {
+ "name": "toolCalls",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "toolResults": {
+ "name": "toolResults",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "isActive": {
+ "name": "isActive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "editedAt": {
+ "name": "editedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "messages_conversation_id_idx": {
+ "name": "messages_conversation_id_idx",
+ "columns": [
+ {
+ "expression": "conversationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "messages_conversation_id_created_at_idx": {
+ "name": "messages_conversation_id_created_at_idx",
+ "columns": [
+ {
+ "expression": "conversationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "messages_user_id_idx": {
+ "name": "messages_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "messages_conversationId_conversations_id_fk": {
+ "name": "messages_conversationId_conversations_id_fk",
+ "tableFrom": "messages",
+ "tableTo": "conversations",
+ "columnsFrom": [
+ "conversationId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "messages_userId_users_id_fk": {
+ "name": "messages_userId_users_id_fk",
+ "tableFrom": "messages",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.notifications": {
+ "name": "notifications",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "NotificationType",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isRead": {
+ "name": "isRead",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "readAt": {
+ "name": "readAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "triggeredByUserId": {
+ "name": "triggeredByUserId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "notifications_user_id_idx": {
+ "name": "notifications_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notifications_user_id_is_read_idx": {
+ "name": "notifications_user_id_is_read_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "isRead",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notifications_created_at_idx": {
+ "name": "notifications_created_at_idx",
+ "columns": [
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notifications_type_idx": {
+ "name": "notifications_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notifications_userId_users_id_fk": {
+ "name": "notifications_userId_users_id_fk",
+ "tableFrom": "notifications",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notifications_pageId_pages_id_fk": {
+ "name": "notifications_pageId_pages_id_fk",
+ "tableFrom": "notifications",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notifications_driveId_drives_id_fk": {
+ "name": "notifications_driveId_drives_id_fk",
+ "tableFrom": "notifications",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notifications_triggeredByUserId_users_id_fk": {
+ "name": "notifications_triggeredByUserId_users_id_fk",
+ "tableFrom": "notifications",
+ "tableTo": "users",
+ "columnsFrom": [
+ "triggeredByUserId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.email_notification_log": {
+ "name": "email_notification_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "notificationId": {
+ "name": "notificationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notificationType": {
+ "name": "notificationType",
+ "type": "NotificationType",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recipientEmail": {
+ "name": "recipientEmail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "success": {
+ "name": "success",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "errorMessage": {
+ "name": "errorMessage",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sentAt": {
+ "name": "sentAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "email_notification_log_user_idx": {
+ "name": "email_notification_log_user_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "email_notification_log_sent_at_idx": {
+ "name": "email_notification_log_sent_at_idx",
+ "columns": [
+ {
+ "expression": "sentAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "email_notification_log_notification_id_idx": {
+ "name": "email_notification_log_notification_id_idx",
+ "columns": [
+ {
+ "expression": "notificationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "email_notification_log_userId_users_id_fk": {
+ "name": "email_notification_log_userId_users_id_fk",
+ "tableFrom": "email_notification_log",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.email_notification_preferences": {
+ "name": "email_notification_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "notificationType": {
+ "name": "notificationType",
+ "type": "NotificationType",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "emailEnabled": {
+ "name": "emailEnabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "email_notification_preferences_user_type_idx": {
+ "name": "email_notification_preferences_user_type_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "notificationType",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "email_notification_preferences_userId_users_id_fk": {
+ "name": "email_notification_preferences_userId_users_id_fk",
+ "tableFrom": "email_notification_preferences",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.activity_logs": {
+ "name": "activity_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actorEmail": {
+ "name": "actorEmail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'legacy@unknown'"
+ },
+ "actorDisplayName": {
+ "name": "actorDisplayName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isAiGenerated": {
+ "name": "isAiGenerated",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "aiProvider": {
+ "name": "aiProvider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aiModel": {
+ "name": "aiModel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aiConversationId": {
+ "name": "aiConversationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "operation": {
+ "name": "operation",
+ "type": "activity_operation",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resourceType": {
+ "name": "resourceType",
+ "type": "activity_resource",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resourceId": {
+ "name": "resourceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resourceTitle": {
+ "name": "resourceTitle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contentSnapshot": {
+ "name": "contentSnapshot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contentFormat": {
+ "name": "contentFormat",
+ "type": "content_format",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contentRef": {
+ "name": "contentRef",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contentSize": {
+ "name": "contentSize",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rollbackFromActivityId": {
+ "name": "rollbackFromActivityId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rollbackSourceOperation": {
+ "name": "rollbackSourceOperation",
+ "type": "activity_operation",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rollbackSourceTimestamp": {
+ "name": "rollbackSourceTimestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rollbackSourceTitle": {
+ "name": "rollbackSourceTitle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updatedFields": {
+ "name": "updatedFields",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "previousValues": {
+ "name": "previousValues",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "newValues": {
+ "name": "newValues",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "streamId": {
+ "name": "streamId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "streamSeq": {
+ "name": "streamSeq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changeGroupId": {
+ "name": "changeGroupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changeGroupType": {
+ "name": "changeGroupType",
+ "type": "activity_change_group_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stateHashBefore": {
+ "name": "stateHashBefore",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stateHashAfter": {
+ "name": "stateHashAfter",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isArchived": {
+ "name": "isArchived",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "previousLogHash": {
+ "name": "previousLogHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "logHash": {
+ "name": "logHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "chainSeed": {
+ "name": "chainSeed",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_activity_logs_timestamp": {
+ "name": "idx_activity_logs_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_activity_logs_user_timestamp": {
+ "name": "idx_activity_logs_user_timestamp",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_activity_logs_drive_timestamp": {
+ "name": "idx_activity_logs_drive_timestamp",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_activity_logs_page_timestamp": {
+ "name": "idx_activity_logs_page_timestamp",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_activity_logs_archived": {
+ "name": "idx_activity_logs_archived",
+ "columns": [
+ {
+ "expression": "isArchived",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_activity_logs_rollback_from": {
+ "name": "idx_activity_logs_rollback_from",
+ "columns": [
+ {
+ "expression": "rollbackFromActivityId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_activity_logs_stream": {
+ "name": "idx_activity_logs_stream",
+ "columns": [
+ {
+ "expression": "streamId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "streamSeq",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"activity_logs\".\"streamId\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_activity_logs_change_group": {
+ "name": "idx_activity_logs_change_group",
+ "columns": [
+ {
+ "expression": "changeGroupId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"activity_logs\".\"changeGroupId\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_activity_logs_log_hash": {
+ "name": "idx_activity_logs_log_hash",
+ "columns": [
+ {
+ "expression": "logHash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"activity_logs\".\"logHash\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "activity_logs_userId_users_id_fk": {
+ "name": "activity_logs_userId_users_id_fk",
+ "tableFrom": "activity_logs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "activity_logs_driveId_drives_id_fk": {
+ "name": "activity_logs_driveId_drives_id_fk",
+ "tableFrom": "activity_logs",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "activity_logs_pageId_pages_id_fk": {
+ "name": "activity_logs_pageId_pages_id_fk",
+ "tableFrom": "activity_logs",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.ai_usage_logs": {
+ "name": "ai_usage_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost": {
+ "name": "cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "streaming_duration": {
+ "name": "streaming_duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "drive_id": {
+ "name": "drive_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completion": {
+ "name": "completion",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "success": {
+ "name": "success",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "context_messages": {
+ "name": "context_messages",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "context_size": {
+ "name": "context_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_prompt_tokens": {
+ "name": "system_prompt_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_definition_tokens": {
+ "name": "tool_definition_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conversation_tokens": {
+ "name": "conversation_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_count": {
+ "name": "message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "was_truncated": {
+ "name": "was_truncated",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "truncation_strategy": {
+ "name": "truncation_strategy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_ai_usage_timestamp": {
+ "name": "idx_ai_usage_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_ai_usage_user_id": {
+ "name": "idx_ai_usage_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_ai_usage_provider": {
+ "name": "idx_ai_usage_provider",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "model",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_ai_usage_cost": {
+ "name": "idx_ai_usage_cost",
+ "columns": [
+ {
+ "expression": "cost",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_ai_usage_conversation": {
+ "name": "idx_ai_usage_conversation",
+ "columns": [
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_ai_usage_context": {
+ "name": "idx_ai_usage_context",
+ "columns": [
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_ai_usage_context_size": {
+ "name": "idx_ai_usage_context_size",
+ "columns": [
+ {
+ "expression": "context_size",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.alert_history": {
+ "name": "alert_history",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "severity": {
+ "name": "severity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "threshold": {
+ "name": "threshold",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actual_value": {
+ "name": "actual_value",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notified": {
+ "name": "notified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "notified_at": {
+ "name": "notified_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notification_channel": {
+ "name": "notification_channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acknowledged": {
+ "name": "acknowledged",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "acknowledged_at": {
+ "name": "acknowledged_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acknowledged_by": {
+ "name": "acknowledged_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_alerts_timestamp": {
+ "name": "idx_alerts_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_alerts_type": {
+ "name": "idx_alerts_type",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_alerts_severity": {
+ "name": "idx_alerts_severity",
+ "columns": [
+ {
+ "expression": "severity",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_alerts_acknowledged": {
+ "name": "idx_alerts_acknowledged",
+ "columns": [
+ {
+ "expression": "acknowledged",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.api_metrics": {
+ "name": "api_metrics",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "endpoint": {
+ "name": "endpoint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "method": {
+ "name": "method",
+ "type": "http_method",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status_code": {
+ "name": "status_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_size": {
+ "name": "request_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_size": {
+ "name": "response_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ip": {
+ "name": "ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cache_hit": {
+ "name": "cache_hit",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "cache_key": {
+ "name": "cache_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_api_metrics_timestamp": {
+ "name": "idx_api_metrics_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_api_metrics_endpoint": {
+ "name": "idx_api_metrics_endpoint",
+ "columns": [
+ {
+ "expression": "endpoint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_api_metrics_user_id": {
+ "name": "idx_api_metrics_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_api_metrics_status": {
+ "name": "idx_api_metrics_status",
+ "columns": [
+ {
+ "expression": "status_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_api_metrics_duration": {
+ "name": "idx_api_metrics_duration",
+ "columns": [
+ {
+ "expression": "duration",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.daily_aggregates": {
+ "name": "daily_aggregates",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "date": {
+ "name": "date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "category": {
+ "name": "category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total_count": {
+ "name": "total_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "success_count": {
+ "name": "success_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "error_count": {
+ "name": "error_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "avg_duration": {
+ "name": "avg_duration",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "min_duration": {
+ "name": "min_duration",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_duration": {
+ "name": "max_duration",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "p50_duration": {
+ "name": "p50_duration",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "p95_duration": {
+ "name": "p95_duration",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "p99_duration": {
+ "name": "p99_duration",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unique_users": {
+ "name": "unique_users",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "unique_sessions": {
+ "name": "unique_sessions",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_cost": {
+ "name": "total_cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "computed_at": {
+ "name": "computed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_aggregates_date": {
+ "name": "idx_aggregates_date",
+ "columns": [
+ {
+ "expression": "date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "category",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_aggregates_category": {
+ "name": "idx_aggregates_category",
+ "columns": [
+ {
+ "expression": "category",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.error_logs": {
+ "name": "error_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stack": {
+ "name": "stack",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "endpoint": {
+ "name": "endpoint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "method": {
+ "name": "method",
+ "type": "http_method",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file": {
+ "name": "file",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "line": {
+ "name": "line",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column": {
+ "name": "column",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ip": {
+ "name": "ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved": {
+ "name": "resolved",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_by": {
+ "name": "resolved_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolution": {
+ "name": "resolution",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_errors_timestamp": {
+ "name": "idx_errors_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_errors_name": {
+ "name": "idx_errors_name",
+ "columns": [
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_errors_user_id": {
+ "name": "idx_errors_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_errors_resolved": {
+ "name": "idx_errors_resolved",
+ "columns": [
+ {
+ "expression": "resolved",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_errors_endpoint": {
+ "name": "idx_errors_endpoint",
+ "columns": [
+ {
+ "expression": "endpoint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.performance_metrics": {
+ "name": "performance_metrics",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "metric": {
+ "name": "metric",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "unit": {
+ "name": "unit",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "drive_id": {
+ "name": "drive_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cpu_usage": {
+ "name": "cpu_usage",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_usage": {
+ "name": "memory_usage",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disk_usage": {
+ "name": "disk_usage",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_performance_timestamp": {
+ "name": "idx_performance_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_performance_metric": {
+ "name": "idx_performance_metric",
+ "columns": [
+ {
+ "expression": "metric",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_performance_value": {
+ "name": "idx_performance_value",
+ "columns": [
+ {
+ "expression": "value",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_performance_user_id": {
+ "name": "idx_performance_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.retention_policies": {
+ "name": "retention_policies",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "subscriptionTier": {
+ "name": "subscriptionTier",
+ "type": "subscription_tier",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "retentionDays": {
+ "name": "retentionDays",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "retention_policies_subscriptionTier_unique": {
+ "name": "retention_policies_subscriptionTier_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "subscriptionTier"
+ ]
+ }
+ }
+ },
+ "public.system_logs": {
+ "name": "system_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "level": {
+ "name": "level",
+ "type": "log_level",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "category": {
+ "name": "category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "drive_id": {
+ "name": "drive_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "endpoint": {
+ "name": "endpoint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "method": {
+ "name": "method",
+ "type": "http_method",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ip": {
+ "name": "ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_name": {
+ "name": "error_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_stack": {
+ "name": "error_stack",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_used": {
+ "name": "memory_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_total": {
+ "name": "memory_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "hostname": {
+ "name": "hostname",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pid": {
+ "name": "pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_system_logs_timestamp": {
+ "name": "idx_system_logs_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_system_logs_level": {
+ "name": "idx_system_logs_level",
+ "columns": [
+ {
+ "expression": "level",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_system_logs_category": {
+ "name": "idx_system_logs_category",
+ "columns": [
+ {
+ "expression": "category",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_system_logs_user_id": {
+ "name": "idx_system_logs_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_system_logs_request_id": {
+ "name": "idx_system_logs_request_id",
+ "columns": [
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_system_logs_error": {
+ "name": "idx_system_logs_error",
+ "columns": [
+ {
+ "expression": "error_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.user_activities": {
+ "name": "user_activities",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource": {
+ "name": "resource",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "drive_id": {
+ "name": "drive_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ip": {
+ "name": "ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_user_activities_timestamp": {
+ "name": "idx_user_activities_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_user_activities_user_id": {
+ "name": "idx_user_activities_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_user_activities_action": {
+ "name": "idx_user_activities_action",
+ "columns": [
+ {
+ "expression": "action",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_user_activities_resource": {
+ "name": "idx_user_activities_resource",
+ "columns": [
+ {
+ "expression": "resource",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.drive_backup_files": {
+ "name": "drive_backup_files",
+ "schema": "",
+ "columns": {
+ "backupId": {
+ "name": "backupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "fileId": {
+ "name": "fileId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storagePath": {
+ "name": "storagePath",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sizeBytes": {
+ "name": "sizeBytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mimeType": {
+ "name": "mimeType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "checksumVersion": {
+ "name": "checksumVersion",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "drive_backup_files_backup_idx": {
+ "name": "drive_backup_files_backup_idx",
+ "columns": [
+ {
+ "expression": "backupId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drive_backup_files_backupId_drive_backups_id_fk": {
+ "name": "drive_backup_files_backupId_drive_backups_id_fk",
+ "tableFrom": "drive_backup_files",
+ "tableTo": "drive_backups",
+ "columnsFrom": [
+ "backupId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "drive_backup_files_backupId_fileId_pk": {
+ "name": "drive_backup_files_backupId_fileId_pk",
+ "columns": [
+ "backupId",
+ "fileId"
+ ]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.drive_backup_members": {
+ "name": "drive_backup_members",
+ "schema": "",
+ "columns": {
+ "backupId": {
+ "name": "backupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "customRoleId": {
+ "name": "customRoleId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invitedBy": {
+ "name": "invitedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invitedAt": {
+ "name": "invitedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acceptedAt": {
+ "name": "acceptedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "drive_backup_members_backup_idx": {
+ "name": "drive_backup_members_backup_idx",
+ "columns": [
+ {
+ "expression": "backupId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drive_backup_members_backupId_drive_backups_id_fk": {
+ "name": "drive_backup_members_backupId_drive_backups_id_fk",
+ "tableFrom": "drive_backup_members",
+ "tableTo": "drive_backups",
+ "columnsFrom": [
+ "backupId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "drive_backup_members_backupId_userId_pk": {
+ "name": "drive_backup_members_backupId_userId_pk",
+ "columns": [
+ "backupId",
+ "userId"
+ ]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.drive_backup_pages": {
+ "name": "drive_backup_pages",
+ "schema": "",
+ "columns": {
+ "backupId": {
+ "name": "backupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pageVersionId": {
+ "name": "pageVersionId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parentId": {
+ "name": "parentId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "originalParentId": {
+ "name": "originalParentId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isTrashed": {
+ "name": "isTrashed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trashedAt": {
+ "name": "trashedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "drive_backup_pages_backup_idx": {
+ "name": "drive_backup_pages_backup_idx",
+ "columns": [
+ {
+ "expression": "backupId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drive_backup_pages_backupId_drive_backups_id_fk": {
+ "name": "drive_backup_pages_backupId_drive_backups_id_fk",
+ "tableFrom": "drive_backup_pages",
+ "tableTo": "drive_backups",
+ "columnsFrom": [
+ "backupId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "drive_backup_pages_pageVersionId_page_versions_id_fk": {
+ "name": "drive_backup_pages_pageVersionId_page_versions_id_fk",
+ "tableFrom": "drive_backup_pages",
+ "tableTo": "page_versions",
+ "columnsFrom": [
+ "pageVersionId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "drive_backup_pages_backupId_pageId_pk": {
+ "name": "drive_backup_pages_backupId_pageId_pk",
+ "columns": [
+ "backupId",
+ "pageId"
+ ]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.drive_backup_permissions": {
+ "name": "drive_backup_permissions",
+ "schema": "",
+ "columns": {
+ "backupId": {
+ "name": "backupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canView": {
+ "name": "canView",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "canEdit": {
+ "name": "canEdit",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "canShare": {
+ "name": "canShare",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "canDelete": {
+ "name": "canDelete",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "grantedBy": {
+ "name": "grantedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "drive_backup_permissions_backup_idx": {
+ "name": "drive_backup_permissions_backup_idx",
+ "columns": [
+ {
+ "expression": "backupId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drive_backup_permissions_backupId_drive_backups_id_fk": {
+ "name": "drive_backup_permissions_backupId_drive_backups_id_fk",
+ "tableFrom": "drive_backup_permissions",
+ "tableTo": "drive_backups",
+ "columnsFrom": [
+ "backupId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "drive_backup_permissions_backupId_pageId_userId_pk": {
+ "name": "drive_backup_permissions_backupId_pageId_userId_pk",
+ "columns": [
+ "backupId",
+ "pageId",
+ "userId"
+ ]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.drive_backup_roles": {
+ "name": "drive_backup_roles",
+ "schema": "",
+ "columns": {
+ "backupId": {
+ "name": "backupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "roleId": {
+ "name": "roleId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isDefault": {
+ "name": "isDefault",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "drive_backup_roles_backup_idx": {
+ "name": "drive_backup_roles_backup_idx",
+ "columns": [
+ {
+ "expression": "backupId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drive_backup_roles_backupId_drive_backups_id_fk": {
+ "name": "drive_backup_roles_backupId_drive_backups_id_fk",
+ "tableFrom": "drive_backup_roles",
+ "tableTo": "drive_backups",
+ "columnsFrom": [
+ "backupId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "drive_backup_roles_backupId_roleId_pk": {
+ "name": "drive_backup_roles_backupId_roleId_pk",
+ "columns": [
+ "backupId",
+ "roleId"
+ ]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.drive_backups": {
+ "name": "drive_backups",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "drive_backup_source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'manual'"
+ },
+ "status": {
+ "name": "status",
+ "type": "drive_backup_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changeGroupId": {
+ "name": "changeGroupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changeGroupType": {
+ "name": "changeGroupType",
+ "type": "activity_change_group_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isPinned": {
+ "name": "isPinned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completedAt": {
+ "name": "completedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failedAt": {
+ "name": "failedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failureReason": {
+ "name": "failureReason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "drive_backups_drive_created_at_idx": {
+ "name": "drive_backups_drive_created_at_idx",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "drive_backups_status_idx": {
+ "name": "drive_backups_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "drive_backups_driveId_drives_id_fk": {
+ "name": "drive_backups_driveId_drives_id_fk",
+ "tableFrom": "drive_backups",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "drive_backups_createdBy_users_id_fk": {
+ "name": "drive_backups_createdBy_users_id_fk",
+ "tableFrom": "drive_backups",
+ "tableTo": "users",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.page_versions": {
+ "name": "page_versions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "page_version_source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'auto'"
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changeGroupId": {
+ "name": "changeGroupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changeGroupType": {
+ "name": "changeGroupType",
+ "type": "activity_change_group_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contentRef": {
+ "name": "contentRef",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contentFormat": {
+ "name": "contentFormat",
+ "type": "content_format",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contentSize": {
+ "name": "contentSize",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stateHash": {
+ "name": "stateHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pageRevision": {
+ "name": "pageRevision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "isPinned": {
+ "name": "isPinned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "page_versions_page_created_at_idx": {
+ "name": "page_versions_page_created_at_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "page_versions_drive_created_at_idx": {
+ "name": "page_versions_drive_created_at_idx",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "page_versions_pinned_idx": {
+ "name": "page_versions_pinned_idx",
+ "columns": [
+ {
+ "expression": "isPinned",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "page_versions_pageId_pages_id_fk": {
+ "name": "page_versions_pageId_pages_id_fk",
+ "tableFrom": "page_versions",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_versions_driveId_drives_id_fk": {
+ "name": "page_versions_driveId_drives_id_fk",
+ "tableFrom": "page_versions",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_versions_createdBy_users_id_fk": {
+ "name": "page_versions_createdBy_users_id_fk",
+ "tableFrom": "page_versions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.connections": {
+ "name": "connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user1Id": {
+ "name": "user1Id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user2Id": {
+ "name": "user2Id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "ConnectionStatus",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING'"
+ },
+ "requestedBy": {
+ "name": "requestedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requestMessage": {
+ "name": "requestMessage",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requestedAt": {
+ "name": "requestedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "acceptedAt": {
+ "name": "acceptedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blockedBy": {
+ "name": "blockedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blockedAt": {
+ "name": "blockedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "connections_user1_id_idx": {
+ "name": "connections_user1_id_idx",
+ "columns": [
+ {
+ "expression": "user1Id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "connections_user2_id_idx": {
+ "name": "connections_user2_id_idx",
+ "columns": [
+ {
+ "expression": "user2Id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "connections_status_idx": {
+ "name": "connections_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "connections_user1_status_idx": {
+ "name": "connections_user1_status_idx",
+ "columns": [
+ {
+ "expression": "user1Id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "connections_user2_status_idx": {
+ "name": "connections_user2_status_idx",
+ "columns": [
+ {
+ "expression": "user2Id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "connections_user1Id_users_id_fk": {
+ "name": "connections_user1Id_users_id_fk",
+ "tableFrom": "connections",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user1Id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "connections_user2Id_users_id_fk": {
+ "name": "connections_user2Id_users_id_fk",
+ "tableFrom": "connections",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user2Id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "connections_requestedBy_users_id_fk": {
+ "name": "connections_requestedBy_users_id_fk",
+ "tableFrom": "connections",
+ "tableTo": "users",
+ "columnsFrom": [
+ "requestedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "connections_blockedBy_users_id_fk": {
+ "name": "connections_blockedBy_users_id_fk",
+ "tableFrom": "connections",
+ "tableTo": "users",
+ "columnsFrom": [
+ "blockedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "connections_user_pair_key": {
+ "name": "connections_user_pair_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user1Id",
+ "user2Id"
+ ]
+ }
+ }
+ },
+ "public.direct_messages": {
+ "name": "direct_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "conversationId": {
+ "name": "conversationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "senderId": {
+ "name": "senderId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "isRead": {
+ "name": "isRead",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "readAt": {
+ "name": "readAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isEdited": {
+ "name": "isEdited",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "editedAt": {
+ "name": "editedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "direct_messages_conversation_id_idx": {
+ "name": "direct_messages_conversation_id_idx",
+ "columns": [
+ {
+ "expression": "conversationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "direct_messages_sender_id_idx": {
+ "name": "direct_messages_sender_id_idx",
+ "columns": [
+ {
+ "expression": "senderId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "direct_messages_created_at_idx": {
+ "name": "direct_messages_created_at_idx",
+ "columns": [
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "direct_messages_conversation_created_idx": {
+ "name": "direct_messages_conversation_created_idx",
+ "columns": [
+ {
+ "expression": "conversationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "direct_messages_conversation_is_read_idx": {
+ "name": "direct_messages_conversation_is_read_idx",
+ "columns": [
+ {
+ "expression": "conversationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "isRead",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "direct_messages_unread_count_idx": {
+ "name": "direct_messages_unread_count_idx",
+ "columns": [
+ {
+ "expression": "conversationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "senderId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "isRead",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "direct_messages_conversationId_dm_conversations_id_fk": {
+ "name": "direct_messages_conversationId_dm_conversations_id_fk",
+ "tableFrom": "direct_messages",
+ "tableTo": "dm_conversations",
+ "columnsFrom": [
+ "conversationId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "direct_messages_senderId_users_id_fk": {
+ "name": "direct_messages_senderId_users_id_fk",
+ "tableFrom": "direct_messages",
+ "tableTo": "users",
+ "columnsFrom": [
+ "senderId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.dm_conversations": {
+ "name": "dm_conversations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "participant1Id": {
+ "name": "participant1Id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "participant2Id": {
+ "name": "participant2Id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "lastMessageAt": {
+ "name": "lastMessageAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastMessagePreview": {
+ "name": "lastMessagePreview",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "participant1LastRead": {
+ "name": "participant1LastRead",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "participant2LastRead": {
+ "name": "participant2LastRead",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "dm_conversations_participant1_id_idx": {
+ "name": "dm_conversations_participant1_id_idx",
+ "columns": [
+ {
+ "expression": "participant1Id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dm_conversations_participant2_id_idx": {
+ "name": "dm_conversations_participant2_id_idx",
+ "columns": [
+ {
+ "expression": "participant2Id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dm_conversations_last_message_at_idx": {
+ "name": "dm_conversations_last_message_at_idx",
+ "columns": [
+ {
+ "expression": "lastMessageAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dm_conversations_participant1_last_message_idx": {
+ "name": "dm_conversations_participant1_last_message_idx",
+ "columns": [
+ {
+ "expression": "participant1Id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lastMessageAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dm_conversations_participant2_last_message_idx": {
+ "name": "dm_conversations_participant2_last_message_idx",
+ "columns": [
+ {
+ "expression": "participant2Id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lastMessageAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dm_conversations_participant1Id_users_id_fk": {
+ "name": "dm_conversations_participant1Id_users_id_fk",
+ "tableFrom": "dm_conversations",
+ "tableTo": "users",
+ "columnsFrom": [
+ "participant1Id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dm_conversations_participant2Id_users_id_fk": {
+ "name": "dm_conversations_participant2Id_users_id_fk",
+ "tableFrom": "dm_conversations",
+ "tableTo": "users",
+ "columnsFrom": [
+ "participant2Id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "dm_conversations_participant_pair_key": {
+ "name": "dm_conversations_participant_pair_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "participant1Id",
+ "participant2Id"
+ ]
+ }
+ }
+ },
+ "public.stripe_events": {
+ "name": "stripe_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "processedAt": {
+ "name": "processedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "stripe_events_type_idx": {
+ "name": "stripe_events_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "stripe_events_processed_at_idx": {
+ "name": "stripe_events_processed_at_idx",
+ "columns": [
+ {
+ "expression": "processedAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.subscriptions": {
+ "name": "subscriptions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripeSubscriptionId": {
+ "name": "stripeSubscriptionId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripePriceId": {
+ "name": "stripePriceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "currentPeriodStart": {
+ "name": "currentPeriodStart",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "currentPeriodEnd": {
+ "name": "currentPeriodEnd",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cancelAtPeriodEnd": {
+ "name": "cancelAtPeriodEnd",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "stripeScheduleId": {
+ "name": "stripeScheduleId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scheduledPriceId": {
+ "name": "scheduledPriceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scheduledChangeDate": {
+ "name": "scheduledChangeDate",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "subscriptions_user_id_idx": {
+ "name": "subscriptions_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "subscriptions_stripe_subscription_id_idx": {
+ "name": "subscriptions_stripe_subscription_id_idx",
+ "columns": [
+ {
+ "expression": "stripeSubscriptionId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "subscriptions_stripe_schedule_id_idx": {
+ "name": "subscriptions_stripe_schedule_id_idx",
+ "columns": [
+ {
+ "expression": "stripeScheduleId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "subscriptions_userId_users_id_fk": {
+ "name": "subscriptions_userId_users_id_fk",
+ "tableFrom": "subscriptions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "subscriptions_stripeSubscriptionId_unique": {
+ "name": "subscriptions_stripeSubscriptionId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripeSubscriptionId"
+ ]
+ }
+ }
+ },
+ "public.contact_submissions": {
+ "name": "contact_submissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject": {
+ "name": "subject",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "contact_submissions_email_idx": {
+ "name": "contact_submissions_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "contact_submissions_created_at_idx": {
+ "name": "contact_submissions_created_at_idx",
+ "columns": [
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.feedback_submissions": {
+ "name": "feedback_submissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachments": {
+ "name": "attachments",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "page_url": {
+ "name": "page_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "screen_size": {
+ "name": "screen_size",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "viewport_size": {
+ "name": "viewport_size",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "app_version": {
+ "name": "app_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "console_errors": {
+ "name": "console_errors",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'new'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "feedback_submissions_user_id_idx": {
+ "name": "feedback_submissions_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "feedback_submissions_status_idx": {
+ "name": "feedback_submissions_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "feedback_submissions_created_at_idx": {
+ "name": "feedback_submissions_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "feedback_submissions_user_id_users_id_fk": {
+ "name": "feedback_submissions_user_id_users_id_fk",
+ "tableFrom": "feedback_submissions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.file_pages": {
+ "name": "file_pages",
+ "schema": "",
+ "columns": {
+ "fileId": {
+ "name": "fileId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "linkedBy": {
+ "name": "linkedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linkedAt": {
+ "name": "linkedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "linkSource": {
+ "name": "linkSource",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "file_pages_file_id_idx": {
+ "name": "file_pages_file_id_idx",
+ "columns": [
+ {
+ "expression": "fileId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "file_pages_page_id_idx": {
+ "name": "file_pages_page_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "file_pages_fileId_files_id_fk": {
+ "name": "file_pages_fileId_files_id_fk",
+ "tableFrom": "file_pages",
+ "tableTo": "files",
+ "columnsFrom": [
+ "fileId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "file_pages_pageId_pages_id_fk": {
+ "name": "file_pages_pageId_pages_id_fk",
+ "tableFrom": "file_pages",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "file_pages_linkedBy_users_id_fk": {
+ "name": "file_pages_linkedBy_users_id_fk",
+ "tableFrom": "file_pages",
+ "tableTo": "users",
+ "columnsFrom": [
+ "linkedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "file_pages_fileId_pageId_pk": {
+ "name": "file_pages_fileId_pageId_pk",
+ "columns": [
+ "fileId",
+ "pageId"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "file_pages_page_id_key": {
+ "name": "file_pages_page_id_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "pageId"
+ ]
+ }
+ }
+ },
+ "public.files": {
+ "name": "files",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sizeBytes": {
+ "name": "sizeBytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mimeType": {
+ "name": "mimeType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "storagePath": {
+ "name": "storagePath",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "checksumVersion": {
+ "name": "checksumVersion",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastAccessedAt": {
+ "name": "lastAccessedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "files_drive_id_idx": {
+ "name": "files_drive_id_idx",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "files_driveId_drives_id_fk": {
+ "name": "files_driveId_drives_id_fk",
+ "tableFrom": "files",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "files_createdBy_users_id_fk": {
+ "name": "files_createdBy_users_id_fk",
+ "tableFrom": "files",
+ "tableTo": "users",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.task_items": {
+ "name": "task_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "taskListId": {
+ "name": "taskListId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assigneeId": {
+ "name": "assigneeId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assigneeAgentId": {
+ "name": "assigneeAgentId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'medium'"
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "dueDate": {
+ "name": "dueDate",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completedAt": {
+ "name": "completedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_items_task_list_id_idx": {
+ "name": "task_items_task_list_id_idx",
+ "columns": [
+ {
+ "expression": "taskListId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_items_task_list_status_idx": {
+ "name": "task_items_task_list_status_idx",
+ "columns": [
+ {
+ "expression": "taskListId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_items_assignee_id_idx": {
+ "name": "task_items_assignee_id_idx",
+ "columns": [
+ {
+ "expression": "assigneeId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_items_assignee_agent_id_idx": {
+ "name": "task_items_assignee_agent_id_idx",
+ "columns": [
+ {
+ "expression": "assigneeAgentId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_items_page_id_idx": {
+ "name": "task_items_page_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_items_taskListId_task_lists_id_fk": {
+ "name": "task_items_taskListId_task_lists_id_fk",
+ "tableFrom": "task_items",
+ "tableTo": "task_lists",
+ "columnsFrom": [
+ "taskListId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_items_userId_users_id_fk": {
+ "name": "task_items_userId_users_id_fk",
+ "tableFrom": "task_items",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_items_assigneeId_users_id_fk": {
+ "name": "task_items_assigneeId_users_id_fk",
+ "tableFrom": "task_items",
+ "tableTo": "users",
+ "columnsFrom": [
+ "assigneeId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "task_items_assigneeAgentId_pages_id_fk": {
+ "name": "task_items_assigneeAgentId_pages_id_fk",
+ "tableFrom": "task_items",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "assigneeAgentId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "task_items_pageId_pages_id_fk": {
+ "name": "task_items_pageId_pages_id_fk",
+ "tableFrom": "task_items",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.task_lists": {
+ "name": "task_lists",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conversationId": {
+ "name": "conversationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_lists_page_id_idx": {
+ "name": "task_lists_page_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_lists_conversation_id_idx": {
+ "name": "task_lists_conversation_id_idx",
+ "columns": [
+ {
+ "expression": "conversationId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_lists_user_id_idx": {
+ "name": "task_lists_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_lists_userId_users_id_fk": {
+ "name": "task_lists_userId_users_id_fk",
+ "tableFrom": "task_lists",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_lists_pageId_pages_id_fk": {
+ "name": "task_lists_pageId_pages_id_fk",
+ "tableFrom": "task_lists",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.security_audit_log": {
+ "name": "security_audit_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "security_event_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "service_id": {
+ "name": "service_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "geo_location": {
+ "name": "geo_location",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "details": {
+ "name": "details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "risk_score": {
+ "name": "risk_score",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "anomaly_flags": {
+ "name": "anomaly_flags",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "previous_hash": {
+ "name": "previous_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_hash": {
+ "name": "event_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "idx_security_audit_timestamp": {
+ "name": "idx_security_audit_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_audit_user_timestamp": {
+ "name": "idx_security_audit_user_timestamp",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_audit_event_type": {
+ "name": "idx_security_audit_event_type",
+ "columns": [
+ {
+ "expression": "event_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_audit_resource": {
+ "name": "idx_security_audit_resource",
+ "columns": [
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_audit_ip": {
+ "name": "idx_security_audit_ip",
+ "columns": [
+ {
+ "expression": "ip_address",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_audit_event_hash": {
+ "name": "idx_security_audit_event_hash",
+ "columns": [
+ {
+ "expression": "event_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_audit_risk_score": {
+ "name": "idx_security_audit_risk_score",
+ "columns": [
+ {
+ "expression": "risk_score",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_audit_session": {
+ "name": "idx_security_audit_session",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_audit_log_user_id_users_id_fk": {
+ "name": "security_audit_log_user_id_users_id_fk",
+ "tableFrom": "security_audit_log",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.user_page_views": {
+ "name": "user_page_views",
+ "schema": "",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "viewedAt": {
+ "name": "viewedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_page_views_user_id_idx": {
+ "name": "user_page_views_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_page_views_page_id_idx": {
+ "name": "user_page_views_page_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_page_views_user_page_idx": {
+ "name": "user_page_views_user_page_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_page_views_userId_users_id_fk": {
+ "name": "user_page_views_userId_users_id_fk",
+ "tableFrom": "user_page_views",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_page_views_pageId_pages_id_fk": {
+ "name": "user_page_views_pageId_pages_id_fk",
+ "tableFrom": "user_page_views",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "user_page_views_userId_pageId_pk": {
+ "name": "user_page_views_userId_pageId_pk",
+ "columns": [
+ "userId",
+ "pageId"
+ ]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.user_hotkey_preferences": {
+ "name": "user_hotkey_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "hotkeyId": {
+ "name": "hotkeyId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "binding": {
+ "name": "binding",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_hotkey_preferences_user_hotkey_idx": {
+ "name": "user_hotkey_preferences_user_hotkey_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "hotkeyId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_hotkey_preferences_user_idx": {
+ "name": "user_hotkey_preferences_user_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_hotkey_preferences_userId_users_id_fk": {
+ "name": "user_hotkey_preferences_userId_users_id_fk",
+ "tableFrom": "user_hotkey_preferences",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.push_notification_tokens": {
+ "name": "push_notification_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "PushPlatformType",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deviceId": {
+ "name": "deviceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deviceName": {
+ "name": "deviceName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isActive": {
+ "name": "isActive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "webPushSubscription": {
+ "name": "webPushSubscription",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "lastUsedAt": {
+ "name": "lastUsedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failedAttempts": {
+ "name": "failedAttempts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "lastFailedAt": {
+ "name": "lastFailedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "push_notification_tokens_user_id_idx": {
+ "name": "push_notification_tokens_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "push_notification_tokens_token_idx": {
+ "name": "push_notification_tokens_token_idx",
+ "columns": [
+ {
+ "expression": "token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "push_notification_tokens_platform_idx": {
+ "name": "push_notification_tokens_platform_idx",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "push_notification_tokens_active_idx": {
+ "name": "push_notification_tokens_active_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "isActive",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "push_notification_tokens_userId_users_id_fk": {
+ "name": "push_notification_tokens_userId_users_id_fk",
+ "tableFrom": "push_notification_tokens",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.global_assistant_config": {
+ "name": "global_assistant_config",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled_user_integrations": {
+ "name": "enabled_user_integrations",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "drive_overrides": {
+ "name": "drive_overrides",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inherit_drive_integrations": {
+ "name": "inherit_drive_integrations",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "global_assistant_config_user_id_users_id_fk": {
+ "name": "global_assistant_config_user_id_users_id_fk",
+ "tableFrom": "global_assistant_config",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "global_assistant_config_user_id_unique": {
+ "name": "global_assistant_config_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id"
+ ]
+ }
+ }
+ },
+ "public.integration_audit_log": {
+ "name": "integration_audit_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "drive_id": {
+ "name": "drive_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_summary": {
+ "name": "input_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "success": {
+ "name": "success",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_code": {
+ "name": "response_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_type": {
+ "name": "error_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_audit_log_drive_id_idx": {
+ "name": "integration_audit_log_drive_id_idx",
+ "columns": [
+ {
+ "expression": "drive_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_audit_log_connection_id_idx": {
+ "name": "integration_audit_log_connection_id_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_audit_log_created_at_idx": {
+ "name": "integration_audit_log_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_audit_log_drive_created_at_idx": {
+ "name": "integration_audit_log_drive_created_at_idx",
+ "columns": [
+ {
+ "expression": "drive_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_audit_log_drive_id_drives_id_fk": {
+ "name": "integration_audit_log_drive_id_drives_id_fk",
+ "tableFrom": "integration_audit_log",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "drive_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integration_audit_log_agent_id_pages_id_fk": {
+ "name": "integration_audit_log_agent_id_pages_id_fk",
+ "tableFrom": "integration_audit_log",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "integration_audit_log_user_id_users_id_fk": {
+ "name": "integration_audit_log_user_id_users_id_fk",
+ "tableFrom": "integration_audit_log",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "integration_audit_log_connection_id_integration_connections_id_fk": {
+ "name": "integration_audit_log_connection_id_integration_connections_id_fk",
+ "tableFrom": "integration_audit_log",
+ "tableTo": "integration_connections",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.integration_connections": {
+ "name": "integration_connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "drive_id": {
+ "name": "drive_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "integration_connection_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "status_message": {
+ "name": "status_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credentials": {
+ "name": "credentials",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "base_url_override": {
+ "name": "base_url_override",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config_overrides": {
+ "name": "config_overrides",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "account_metadata": {
+ "name": "account_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "visibility": {
+ "name": "visibility",
+ "type": "integration_visibility",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'owned_drives'"
+ },
+ "oauth_state": {
+ "name": "oauth_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connected_by": {
+ "name": "connected_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connected_at": {
+ "name": "connected_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_health_check": {
+ "name": "last_health_check",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_connections_provider_id_idx": {
+ "name": "integration_connections_provider_id_idx",
+ "columns": [
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_connections_user_id_idx": {
+ "name": "integration_connections_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_connections_drive_id_idx": {
+ "name": "integration_connections_drive_id_idx",
+ "columns": [
+ {
+ "expression": "drive_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_connections_provider_id_integration_providers_id_fk": {
+ "name": "integration_connections_provider_id_integration_providers_id_fk",
+ "tableFrom": "integration_connections",
+ "tableTo": "integration_providers",
+ "columnsFrom": [
+ "provider_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integration_connections_user_id_users_id_fk": {
+ "name": "integration_connections_user_id_users_id_fk",
+ "tableFrom": "integration_connections",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integration_connections_drive_id_drives_id_fk": {
+ "name": "integration_connections_drive_id_drives_id_fk",
+ "tableFrom": "integration_connections",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "drive_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integration_connections_connected_by_users_id_fk": {
+ "name": "integration_connections_connected_by_users_id_fk",
+ "tableFrom": "integration_connections",
+ "tableTo": "users",
+ "columnsFrom": [
+ "connected_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "integration_connections_user_provider": {
+ "name": "integration_connections_user_provider",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id",
+ "provider_id"
+ ]
+ },
+ "integration_connections_drive_provider": {
+ "name": "integration_connections_drive_provider",
+ "nullsNotDistinct": false,
+ "columns": [
+ "drive_id",
+ "provider_id"
+ ]
+ }
+ }
+ },
+ "public.integration_providers": {
+ "name": "integration_providers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "documentation_url": {
+ "name": "documentation_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_type": {
+ "name": "provider_type",
+ "type": "integration_provider_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "openapi_spec": {
+ "name": "openapi_spec",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_system": {
+ "name": "is_system",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "drive_id": {
+ "name": "drive_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_providers_slug_idx": {
+ "name": "integration_providers_slug_idx",
+ "columns": [
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_providers_drive_id_idx": {
+ "name": "integration_providers_drive_id_idx",
+ "columns": [
+ {
+ "expression": "drive_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_providers_created_by_users_id_fk": {
+ "name": "integration_providers_created_by_users_id_fk",
+ "tableFrom": "integration_providers",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "integration_providers_drive_id_drives_id_fk": {
+ "name": "integration_providers_drive_id_drives_id_fk",
+ "tableFrom": "integration_providers",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "drive_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "integration_providers_slug_unique": {
+ "name": "integration_providers_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ }
+ },
+ "public.integration_tool_grants": {
+ "name": "integration_tool_grants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "allowed_tools": {
+ "name": "allowed_tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "denied_tools": {
+ "name": "denied_tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "read_only": {
+ "name": "read_only",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "rate_limit_override": {
+ "name": "rate_limit_override",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_tool_grants_agent_id_idx": {
+ "name": "integration_tool_grants_agent_id_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_tool_grants_connection_id_idx": {
+ "name": "integration_tool_grants_connection_id_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_tool_grants_agent_id_pages_id_fk": {
+ "name": "integration_tool_grants_agent_id_pages_id_fk",
+ "tableFrom": "integration_tool_grants",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integration_tool_grants_connection_id_integration_connections_id_fk": {
+ "name": "integration_tool_grants_connection_id_integration_connections_id_fk",
+ "tableFrom": "integration_tool_grants",
+ "tableTo": "integration_connections",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "integration_tool_grants_agent_connection": {
+ "name": "integration_tool_grants_agent_connection",
+ "nullsNotDistinct": false,
+ "columns": [
+ "agent_id",
+ "connection_id"
+ ]
+ }
+ }
+ },
+ "public.user_personalization": {
+ "name": "user_personalization",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bio": {
+ "name": "bio",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "writingStyle": {
+ "name": "writingStyle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rules": {
+ "name": "rules",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_personalization_user_idx": {
+ "name": "user_personalization_user_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_personalization_userId_users_id_fk": {
+ "name": "user_personalization_userId_users_id_fk",
+ "tableFrom": "user_personalization",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.calendar_events": {
+ "name": "calendar_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "driveId": {
+ "name": "driveId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdById": {
+ "name": "createdById",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pageId": {
+ "name": "pageId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "location": {
+ "name": "location",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "startAt": {
+ "name": "startAt",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endAt": {
+ "name": "endAt",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "allDay": {
+ "name": "allDay",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'UTC'"
+ },
+ "recurrenceRule": {
+ "name": "recurrenceRule",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "recurrenceExceptions": {
+ "name": "recurrenceExceptions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "recurringEventId": {
+ "name": "recurringEventId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "originalStartAt": {
+ "name": "originalStartAt",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "visibility": {
+ "name": "visibility",
+ "type": "EventVisibility",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'DRIVE'"
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'default'"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isTrashed": {
+ "name": "isTrashed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trashedAt": {
+ "name": "trashedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "calendar_events_drive_id_idx": {
+ "name": "calendar_events_drive_id_idx",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "calendar_events_created_by_id_idx": {
+ "name": "calendar_events_created_by_id_idx",
+ "columns": [
+ {
+ "expression": "createdById",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "calendar_events_page_id_idx": {
+ "name": "calendar_events_page_id_idx",
+ "columns": [
+ {
+ "expression": "pageId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "calendar_events_start_at_idx": {
+ "name": "calendar_events_start_at_idx",
+ "columns": [
+ {
+ "expression": "startAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "calendar_events_end_at_idx": {
+ "name": "calendar_events_end_at_idx",
+ "columns": [
+ {
+ "expression": "endAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "calendar_events_drive_id_start_at_idx": {
+ "name": "calendar_events_drive_id_start_at_idx",
+ "columns": [
+ {
+ "expression": "driveId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "startAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "calendar_events_recurring_event_id_idx": {
+ "name": "calendar_events_recurring_event_id_idx",
+ "columns": [
+ {
+ "expression": "recurringEventId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "calendar_events_is_trashed_idx": {
+ "name": "calendar_events_is_trashed_idx",
+ "columns": [
+ {
+ "expression": "isTrashed",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "calendar_events_driveId_drives_id_fk": {
+ "name": "calendar_events_driveId_drives_id_fk",
+ "tableFrom": "calendar_events",
+ "tableTo": "drives",
+ "columnsFrom": [
+ "driveId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "calendar_events_createdById_users_id_fk": {
+ "name": "calendar_events_createdById_users_id_fk",
+ "tableFrom": "calendar_events",
+ "tableTo": "users",
+ "columnsFrom": [
+ "createdById"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "calendar_events_pageId_pages_id_fk": {
+ "name": "calendar_events_pageId_pages_id_fk",
+ "tableFrom": "calendar_events",
+ "tableTo": "pages",
+ "columnsFrom": [
+ "pageId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.event_attendees": {
+ "name": "event_attendees",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "eventId": {
+ "name": "eventId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "AttendeeStatus",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING'"
+ },
+ "responseNote": {
+ "name": "responseNote",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "isOrganizer": {
+ "name": "isOrganizer",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "isOptional": {
+ "name": "isOptional",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "invitedAt": {
+ "name": "invitedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "respondedAt": {
+ "name": "respondedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "event_attendees_event_id_idx": {
+ "name": "event_attendees_event_id_idx",
+ "columns": [
+ {
+ "expression": "eventId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "event_attendees_user_id_idx": {
+ "name": "event_attendees_user_id_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "event_attendees_status_idx": {
+ "name": "event_attendees_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "event_attendees_user_id_status_idx": {
+ "name": "event_attendees_user_id_status_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "event_attendees_eventId_calendar_events_id_fk": {
+ "name": "event_attendees_eventId_calendar_events_id_fk",
+ "tableFrom": "event_attendees",
+ "tableTo": "calendar_events",
+ "columnsFrom": [
+ "eventId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "event_attendees_userId_users_id_fk": {
+ "name": "event_attendees_userId_users_id_fk",
+ "tableFrom": "event_attendees",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "event_attendees_event_user_key": {
+ "name": "event_attendees_event_user_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "eventId",
+ "userId"
+ ]
+ }
+ }
+ }
+ },
+ "enums": {
+ "public.AuthProvider": {
+ "name": "AuthProvider",
+ "schema": "public",
+ "values": [
+ "email",
+ "google",
+ "apple",
+ "both"
+ ]
+ },
+ "public.PlatformType": {
+ "name": "PlatformType",
+ "schema": "public",
+ "values": [
+ "web",
+ "desktop",
+ "ios",
+ "android"
+ ]
+ },
+ "public.UserRole": {
+ "name": "UserRole",
+ "schema": "public",
+ "values": [
+ "user",
+ "admin"
+ ]
+ },
+ "public.FavoriteItemType": {
+ "name": "FavoriteItemType",
+ "schema": "public",
+ "values": [
+ "page",
+ "drive"
+ ]
+ },
+ "public.PageType": {
+ "name": "PageType",
+ "schema": "public",
+ "values": [
+ "FOLDER",
+ "DOCUMENT",
+ "CHANNEL",
+ "AI_CHAT",
+ "CANVAS",
+ "FILE",
+ "SHEET",
+ "TASK_LIST"
+ ]
+ },
+ "public.PermissionAction": {
+ "name": "PermissionAction",
+ "schema": "public",
+ "values": [
+ "VIEW",
+ "EDIT",
+ "SHARE",
+ "DELETE"
+ ]
+ },
+ "public.SubjectType": {
+ "name": "SubjectType",
+ "schema": "public",
+ "values": [
+ "USER"
+ ]
+ },
+ "public.InvitationStatus": {
+ "name": "InvitationStatus",
+ "schema": "public",
+ "values": [
+ "PENDING",
+ "ACCEPTED",
+ "REJECTED",
+ "EXPIRED"
+ ]
+ },
+ "public.MemberRole": {
+ "name": "MemberRole",
+ "schema": "public",
+ "values": [
+ "OWNER",
+ "ADMIN",
+ "MEMBER"
+ ]
+ },
+ "public.pulse_summary_type": {
+ "name": "pulse_summary_type",
+ "schema": "public",
+ "values": [
+ "scheduled",
+ "on_demand",
+ "welcome"
+ ]
+ },
+ "public.NotificationType": {
+ "name": "NotificationType",
+ "schema": "public",
+ "values": [
+ "PERMISSION_GRANTED",
+ "PERMISSION_REVOKED",
+ "PERMISSION_UPDATED",
+ "PAGE_SHARED",
+ "DRIVE_INVITED",
+ "DRIVE_JOINED",
+ "DRIVE_ROLE_CHANGED",
+ "CONNECTION_REQUEST",
+ "CONNECTION_ACCEPTED",
+ "CONNECTION_REJECTED",
+ "NEW_DIRECT_MESSAGE",
+ "EMAIL_VERIFICATION_REQUIRED",
+ "TOS_PRIVACY_UPDATED",
+ "MENTION",
+ "TASK_ASSIGNED"
+ ]
+ },
+ "public.activity_change_group_type": {
+ "name": "activity_change_group_type",
+ "schema": "public",
+ "values": [
+ "user",
+ "ai",
+ "automation",
+ "system"
+ ]
+ },
+ "public.activity_operation": {
+ "name": "activity_operation",
+ "schema": "public",
+ "values": [
+ "create",
+ "update",
+ "delete",
+ "restore",
+ "reorder",
+ "permission_grant",
+ "permission_update",
+ "permission_revoke",
+ "trash",
+ "move",
+ "agent_config_update",
+ "member_add",
+ "member_remove",
+ "member_role_change",
+ "login",
+ "logout",
+ "signup",
+ "password_change",
+ "email_change",
+ "token_create",
+ "token_revoke",
+ "upload",
+ "convert",
+ "account_delete",
+ "profile_update",
+ "avatar_update",
+ "message_update",
+ "message_delete",
+ "role_reorder",
+ "ownership_transfer",
+ "rollback",
+ "conversation_undo",
+ "conversation_undo_with_changes"
+ ]
+ },
+ "public.activity_resource": {
+ "name": "activity_resource",
+ "schema": "public",
+ "values": [
+ "page",
+ "drive",
+ "permission",
+ "agent",
+ "user",
+ "member",
+ "role",
+ "file",
+ "token",
+ "device",
+ "message",
+ "conversation"
+ ]
+ },
+ "public.content_format": {
+ "name": "content_format",
+ "schema": "public",
+ "values": [
+ "text",
+ "html",
+ "json",
+ "tiptap"
+ ]
+ },
+ "public.http_method": {
+ "name": "http_method",
+ "schema": "public",
+ "values": [
+ "GET",
+ "POST",
+ "PUT",
+ "DELETE",
+ "PATCH",
+ "HEAD",
+ "OPTIONS"
+ ]
+ },
+ "public.log_level": {
+ "name": "log_level",
+ "schema": "public",
+ "values": [
+ "trace",
+ "debug",
+ "info",
+ "warn",
+ "error",
+ "fatal"
+ ]
+ },
+ "public.subscription_tier": {
+ "name": "subscription_tier",
+ "schema": "public",
+ "values": [
+ "free",
+ "pro",
+ "business",
+ "founder"
+ ]
+ },
+ "public.drive_backup_source": {
+ "name": "drive_backup_source",
+ "schema": "public",
+ "values": [
+ "manual",
+ "scheduled",
+ "pre_restore",
+ "system"
+ ]
+ },
+ "public.drive_backup_status": {
+ "name": "drive_backup_status",
+ "schema": "public",
+ "values": [
+ "pending",
+ "ready",
+ "failed"
+ ]
+ },
+ "public.page_version_source": {
+ "name": "page_version_source",
+ "schema": "public",
+ "values": [
+ "manual",
+ "auto",
+ "pre_ai",
+ "pre_restore",
+ "restore",
+ "system"
+ ]
+ },
+ "public.ConnectionStatus": {
+ "name": "ConnectionStatus",
+ "schema": "public",
+ "values": [
+ "PENDING",
+ "ACCEPTED",
+ "BLOCKED"
+ ]
+ },
+ "public.security_event_type": {
+ "name": "security_event_type",
+ "schema": "public",
+ "values": [
+ "auth.login.success",
+ "auth.login.failure",
+ "auth.logout",
+ "auth.token.created",
+ "auth.token.revoked",
+ "auth.token.refreshed",
+ "auth.password.changed",
+ "auth.password.reset.requested",
+ "auth.password.reset.completed",
+ "auth.mfa.enabled",
+ "auth.mfa.disabled",
+ "auth.mfa.challenged",
+ "auth.mfa.verified",
+ "auth.session.created",
+ "auth.session.revoked",
+ "auth.device.registered",
+ "auth.device.revoked",
+ "authz.access.granted",
+ "authz.access.denied",
+ "authz.permission.granted",
+ "authz.permission.revoked",
+ "authz.role.assigned",
+ "authz.role.removed",
+ "data.read",
+ "data.write",
+ "data.delete",
+ "data.export",
+ "data.share",
+ "admin.user.created",
+ "admin.user.suspended",
+ "admin.user.reactivated",
+ "admin.user.deleted",
+ "admin.settings.changed",
+ "security.anomaly.detected",
+ "security.rate.limited",
+ "security.brute.force.detected",
+ "security.suspicious.activity"
+ ]
+ },
+ "public.PushPlatformType": {
+ "name": "PushPlatformType",
+ "schema": "public",
+ "values": [
+ "ios",
+ "android",
+ "web"
+ ]
+ },
+ "public.integration_connection_status": {
+ "name": "integration_connection_status",
+ "schema": "public",
+ "values": [
+ "active",
+ "expired",
+ "error",
+ "pending",
+ "revoked"
+ ]
+ },
+ "public.integration_provider_type": {
+ "name": "integration_provider_type",
+ "schema": "public",
+ "values": [
+ "builtin",
+ "openapi",
+ "custom",
+ "mcp",
+ "webhook"
+ ]
+ },
+ "public.integration_visibility": {
+ "name": "integration_visibility",
+ "schema": "public",
+ "values": [
+ "private",
+ "owned_drives",
+ "all_drives"
+ ]
+ },
+ "public.AttendeeStatus": {
+ "name": "AttendeeStatus",
+ "schema": "public",
+ "values": [
+ "PENDING",
+ "ACCEPTED",
+ "DECLINED",
+ "TENTATIVE"
+ ]
+ },
+ "public.EventVisibility": {
+ "name": "EventVisibility",
+ "schema": "public",
+ "values": [
+ "DRIVE",
+ "ATTENDEES_ONLY",
+ "PRIVATE"
+ ]
+ },
+ "public.RecurrenceFrequency": {
+ "name": "RecurrenceFrequency",
+ "schema": "public",
+ "values": [
+ "DAILY",
+ "WEEKLY",
+ "MONTHLY",
+ "YEARLY"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index 102c2cde7..36533dbf1 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -449,6 +449,13 @@
"when": 1770076445757,
"tag": "0063_fast_felicia_hardy",
"breakpoints": true
+ },
+ {
+ "idx": 64,
+ "version": "7",
+ "when": 1770081166151,
+ "tag": "0064_curious_tigra",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts
index 31f799ac2..571e4cc5d 100644
--- a/packages/db/src/schema.ts
+++ b/packages/db/src/schema.ts
@@ -23,6 +23,7 @@ export * from './schema/hotkeys';
export * from './schema/push-notifications';
export * from './schema/integrations';
export * from './schema/personalization';
+export * from './schema/calendar';
import * as auth from './schema/auth';
import * as sessions from './schema/sessions';
@@ -49,6 +50,7 @@ import * as hotkeys from './schema/hotkeys';
import * as pushNotifications from './schema/push-notifications';
import * as integrations from './schema/integrations';
import * as personalization from './schema/personalization';
+import * as calendar from './schema/calendar';
export const schema = {
...auth,
@@ -76,4 +78,5 @@ export const schema = {
...pushNotifications,
...integrations,
...personalization,
+ ...calendar,
};
diff --git a/packages/db/src/schema/calendar.ts b/packages/db/src/schema/calendar.ts
new file mode 100644
index 000000000..ad2d70daa
--- /dev/null
+++ b/packages/db/src/schema/calendar.ts
@@ -0,0 +1,156 @@
+import { pgTable, text, timestamp, boolean, pgEnum, index, unique, jsonb } from 'drizzle-orm/pg-core';
+import { relations } from 'drizzle-orm';
+import { users } from './auth';
+import { drives, pages } from './core';
+import { createId } from '@paralleldrive/cuid2';
+
+// Event visibility levels
+export const eventVisibility = pgEnum('EventVisibility', ['DRIVE', 'ATTENDEES_ONLY', 'PRIVATE']);
+
+// Attendee response status
+export const attendeeStatus = pgEnum('AttendeeStatus', ['PENDING', 'ACCEPTED', 'DECLINED', 'TENTATIVE']);
+
+// Recurrence frequency
+export const recurrenceFrequency = pgEnum('RecurrenceFrequency', ['DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY']);
+
+/**
+ * Calendar Events
+ * Events belong to a drive (driveId set) OR are personal events (driveId null)
+ * Personal events are only visible to the creator
+ * Drive events are visible to drive members based on visibility setting
+ */
+export const calendarEvents = pgTable('calendar_events', {
+ id: text('id').primaryKey().$defaultFn(() => createId()),
+
+ // Ownership - null driveId means personal calendar
+ driveId: text('driveId').references(() => drives.id, { onDelete: 'cascade' }),
+ createdById: text('createdById').notNull().references(() => users.id, { onDelete: 'cascade' }),
+
+ // Optional link to a page (project, channel, etc.)
+ pageId: text('pageId').references(() => pages.id, { onDelete: 'set null' }),
+
+ // Event details
+ title: text('title').notNull(),
+ description: text('description'),
+ location: text('location'),
+
+ // Temporal fields
+ startAt: timestamp('startAt', { mode: 'date', withTimezone: true }).notNull(),
+ endAt: timestamp('endAt', { mode: 'date', withTimezone: true }).notNull(),
+ allDay: boolean('allDay').default(false).notNull(),
+ timezone: text('timezone').default('UTC').notNull(),
+
+ // Recurrence (AI-parseable structure)
+ recurrenceRule: jsonb('recurrenceRule').$type<{
+ frequency: 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY';
+ interval: number; // e.g., every 2 weeks
+ byDay?: ('MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'SU')[]; // for weekly
+ byMonthDay?: number[]; // for monthly (1-31)
+ byMonth?: number[]; // for yearly (1-12)
+ count?: number; // end after N occurrences
+ until?: string; // end by date (ISO string)
+ } | null>(),
+ recurrenceExceptions: jsonb('recurrenceExceptions').$type().default([]), // ISO date strings to skip
+
+ // For recurrence instances - references the parent recurring event
+ // Note: Self-referential FK handled via relations to avoid circular type inference
+ recurringEventId: text('recurringEventId'),
+ originalStartAt: timestamp('originalStartAt', { mode: 'date', withTimezone: true }), // Original time if modified instance
+
+ // Visibility and collaboration
+ visibility: eventVisibility('visibility').default('DRIVE').notNull(),
+
+ // Color category for visual distinction
+ color: text('color').default('default'), // 'default', 'meeting', 'deadline', 'personal', 'travel', 'focus'
+
+ // Metadata for extensibility
+ metadata: jsonb('metadata'),
+
+ // Soft delete
+ isTrashed: boolean('isTrashed').default(false).notNull(),
+ trashedAt: timestamp('trashedAt', { mode: 'date' }),
+
+ // Audit timestamps
+ createdAt: timestamp('createdAt', { mode: 'date' }).defaultNow().notNull(),
+ updatedAt: timestamp('updatedAt', { mode: 'date' }).notNull().$onUpdate(() => new Date()),
+}, (table) => {
+ return {
+ driveIdx: index('calendar_events_drive_id_idx').on(table.driveId),
+ createdByIdx: index('calendar_events_created_by_id_idx').on(table.createdById),
+ pageIdx: index('calendar_events_page_id_idx').on(table.pageId),
+ startAtIdx: index('calendar_events_start_at_idx').on(table.startAt),
+ endAtIdx: index('calendar_events_end_at_idx').on(table.endAt),
+ driveStartAtIdx: index('calendar_events_drive_id_start_at_idx').on(table.driveId, table.startAt),
+ recurringEventIdx: index('calendar_events_recurring_event_id_idx').on(table.recurringEventId),
+ trashedIdx: index('calendar_events_is_trashed_idx').on(table.isTrashed),
+ }
+});
+
+/**
+ * Event Attendees
+ * Tracks who is invited to an event and their response status
+ */
+export const eventAttendees = pgTable('event_attendees', {
+ id: text('id').primaryKey().$defaultFn(() => createId()),
+ eventId: text('eventId').notNull().references(() => calendarEvents.id, { onDelete: 'cascade' }),
+ userId: text('userId').notNull().references(() => users.id, { onDelete: 'cascade' }),
+
+ // Response status
+ status: attendeeStatus('status').default('PENDING').notNull(),
+ responseNote: text('responseNote'),
+
+ // Whether this attendee is the organizer
+ isOrganizer: boolean('isOrganizer').default(false).notNull(),
+
+ // Whether this attendee is optional
+ isOptional: boolean('isOptional').default(false).notNull(),
+
+ // Timestamps
+ invitedAt: timestamp('invitedAt', { mode: 'date' }).defaultNow().notNull(),
+ respondedAt: timestamp('respondedAt', { mode: 'date' }),
+}, (table) => {
+ return {
+ eventUserKey: unique('event_attendees_event_user_key').on(table.eventId, table.userId),
+ eventIdx: index('event_attendees_event_id_idx').on(table.eventId),
+ userIdx: index('event_attendees_user_id_idx').on(table.userId),
+ statusIdx: index('event_attendees_status_idx').on(table.status),
+ userStatusIdx: index('event_attendees_user_id_status_idx').on(table.userId, table.status),
+ }
+});
+
+// Relations
+export const calendarEventsRelations = relations(calendarEvents, ({ one, many }) => ({
+ drive: one(drives, {
+ fields: [calendarEvents.driveId],
+ references: [drives.id],
+ }),
+ createdBy: one(users, {
+ fields: [calendarEvents.createdById],
+ references: [users.id],
+ relationName: 'eventCreator',
+ }),
+ page: one(pages, {
+ fields: [calendarEvents.pageId],
+ references: [pages.id],
+ }),
+ recurringEvent: one(calendarEvents, {
+ fields: [calendarEvents.recurringEventId],
+ references: [calendarEvents.id],
+ relationName: 'recurringInstances',
+ }),
+ instances: many(calendarEvents, {
+ relationName: 'recurringInstances',
+ }),
+ attendees: many(eventAttendees),
+}));
+
+export const eventAttendeesRelations = relations(eventAttendees, ({ one }) => ({
+ event: one(calendarEvents, {
+ fields: [eventAttendees.eventId],
+ references: [calendarEvents.id],
+ }),
+ user: one(users, {
+ fields: [eventAttendees.userId],
+ references: [users.id],
+ }),
+}));
diff --git a/packages/lib/src/services/drive-member-service.ts b/packages/lib/src/services/drive-member-service.ts
index cd66b8a16..8d1616376 100644
--- a/packages/lib/src/services/drive-member-service.ts
+++ b/packages/lib/src/services/drive-member-service.ts
@@ -116,6 +116,19 @@ export async function checkDriveAccess(
};
}
+/**
+ * Get all user IDs that are members of a drive
+ * Efficient query for authorization checks
+ */
+export async function getDriveMemberUserIds(driveId: string): Promise {
+ const members = await db
+ .select({ userId: driveMembers.userId })
+ .from(driveMembers)
+ .where(eq(driveMembers.driveId, driveId));
+
+ return members.map((m) => m.userId);
+}
+
/**
* List all members of a drive with their details and permission counts
*/
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 03231928f..3f6dc3535 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -465,6 +465,9 @@ importers:
'@radix-ui/react-tabs':
specifier: ^1.1.12
version: 1.1.13(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-toggle':
+ specifier: ^1.1.10
+ version: 1.1.10(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
'@radix-ui/react-tooltip':
specifier: ^1.2.8
version: 1.2.8(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
@@ -573,6 +576,9 @@ importers:
prettier:
specifier: ^3.6.2
version: 3.6.2
+ radix-ui:
+ specifier: ^1.4.3
+ version: 1.4.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
react:
specifier: ^19.1.2
version: 19.2.1
@@ -2900,6 +2906,19 @@ packages:
'@radix-ui/primitive@1.1.3':
resolution: {integrity: sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==}
+ '@radix-ui/react-accessible-icon@1.1.7':
+ resolution: {integrity: sha512-XM+E4WXl0OqUJFovy6GjmxxFyx9opfCAIUku4dlKRd5YEPqt4kALOkQOp0Of6reHuUkJuiPBEc5k0o4z4lTC8A==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/react-accordion@1.2.12':
resolution: {integrity: sha512-T4nygeh9YE9dLRPhAHSeOZi7HBXo+0kYIPJXayZfvWOWA0+n3dESrZbjfDPUABkUNym6Hd+f2IR113To8D2GPA==}
peerDependencies:
@@ -2939,6 +2958,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/react-aspect-ratio@1.1.7':
+ resolution: {integrity: sha512-Yq6lvO9HQyPwev1onK1daHCHqXVLzPhSVjmsNjCa2Zcxy2f7uJD2itDtxknv6FzAKCwD1qQkeVDmX/cev13n/g==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/react-avatar@1.1.10':
resolution: {integrity: sha512-V8piFfWapM5OmNCXTzVQY+E1rDa53zY+MQ4Y7356v4fFz6vqCyUtIz2rUD44ZEdwg78/jKmMJHj07+C/Z/rcog==}
peerDependencies:
@@ -3092,6 +3124,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/react-form@0.1.8':
+ resolution: {integrity: sha512-QM70k4Zwjttifr5a4sZFts9fn8FzHYvQ5PiB19O2HsYibaHSVt9fH9rzB0XZo/YcM+b7t/p7lYCT/F5eOeF5yQ==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/react-hover-card@1.1.15':
resolution: {integrity: sha512-qgTkjNT1CfKMoP0rcasmlH2r1DAiYicWsDsufxl940sT2wHNEWWv6FMWIQXWhVdmC1d/HYfbhQx60KYyAtKxjg==}
peerDependencies:
@@ -3140,6 +3185,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/react-menubar@1.1.16':
+ resolution: {integrity: sha512-EB1FktTz5xRRi2Er974AUQZWg2yVBb1yjip38/lgwtCVRd3a+maUoGHN/xs9Yv8SY8QwbSEb+YrxGadVWbEutA==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/react-navigation-menu@1.2.14':
resolution: {integrity: sha512-YB9mTFQvCOAQMHU+C/jVl96WmuWeltyUEpRJJky51huhds5W2FQr1J8D/16sQlf0ozxkPK8uF3niQMdUwZPv5w==}
peerDependencies:
@@ -3153,6 +3211,32 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/react-one-time-password-field@0.1.8':
+ resolution: {integrity: sha512-ycS4rbwURavDPVjCb5iS3aG4lURFDILi6sKI/WITUMZ13gMmn/xGjpLoqBAalhJaDk8I3UbCM5GzKHrnzwHbvg==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/react-password-toggle-field@0.1.3':
+ resolution: {integrity: sha512-/UuCrDBWravcaMix4TdT+qlNdVwOM1Nck9kWx/vafXsdfj1ChfhOdfi3cy9SGBpWgTXwYCuboT/oYpJy3clqfw==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/react-popover@1.1.15':
resolution: {integrity: sha512-kr0X2+6Yy/vJzLYJUPCZEc8SfQcf+1COFoAqauJm74umQhta9M7lNJHP7QQS3vkvcGLQUbWpMzwrXYwrYztHKA==}
peerDependencies:
@@ -3344,6 +3428,58 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/react-toast@1.2.15':
+ resolution: {integrity: sha512-3OSz3TacUWy4WtOXV38DggwxoqJK4+eDkNMl5Z/MJZaoUPaP4/9lf81xXMe1I2ReTAptverZUpbPY4wWwWyL5g==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/react-toggle-group@1.1.11':
+ resolution: {integrity: sha512-5umnS0T8JQzQT6HbPyO7Hh9dgd82NmS36DQr+X/YJ9ctFNCiiQd6IJAYYZ33LUwm8M+taCz5t2ui29fHZc4Y6Q==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/react-toggle@1.1.10':
+ resolution: {integrity: sha512-lS1odchhFTeZv3xwHH31YPObmJn8gOg7Lq12inrr0+BH/l3Tsq32VfjqH1oh80ARM3mlkfMic15n0kg4sD1poQ==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/react-toolbar@1.1.11':
+ resolution: {integrity: sha512-4ol06/1bLoFu1nwUqzdD4Y5RZ9oDdKeiHIsntug54Hcr1pgaHiPqHFEaXI1IFP/EsOfROQZ8Mig9VTIRza6Tjg==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/react-tooltip@1.2.8':
resolution: {integrity: sha512-tY7sVt1yL9ozIxvmbtN5qtmH2krXcBCfjEiCgKGLqunJHvgvZG2Pcl2oQ3kbcZARb1BGEHdkLzcYGO8ynVlieg==}
peerDependencies:
@@ -8566,6 +8702,19 @@ packages:
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
engines: {node: '>=10'}
+ radix-ui@1.4.3:
+ resolution: {integrity: sha512-aWizCQiyeAenIdUbqEpXgRA1ya65P13NKn/W8rWkcN0OPkRDxdBVLWnIEDsS2RpwCK2nobI7oMUSmexzTDyAmA==}
+ peerDependencies:
+ '@types/react': ^19.1.13
+ '@types/react-dom': ^19.1.9
+ react: ^19.1.2
+ react-dom: ^19.1.2
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
randombytes@2.1.0:
resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
@@ -11922,6 +12071,15 @@ snapshots:
'@radix-ui/primitive@1.1.3': {}
+ '@radix-ui/react-accessible-icon@1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/react-visually-hidden': 1.2.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
'@radix-ui/react-accordion@1.2.12(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
dependencies:
'@radix-ui/primitive': 1.1.3
@@ -11962,6 +12120,15 @@ snapshots:
'@types/react': 19.1.13
'@types/react-dom': 19.1.9(@types/react@19.1.13)
+ '@radix-ui/react-aspect-ratio@1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
'@radix-ui/react-avatar@1.1.10(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
dependencies:
'@radix-ui/react-context': 1.1.2(@types/react@19.1.13)(react@19.2.1)
@@ -12118,6 +12285,20 @@ snapshots:
'@types/react': 19.1.13
'@types/react-dom': 19.1.9(@types/react@19.1.13)
+ '@radix-ui/react-form@0.1.8(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-context': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-id': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-label': 2.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
'@radix-ui/react-hover-card@1.1.15(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
dependencies:
'@radix-ui/primitive': 1.1.3
@@ -12177,6 +12358,24 @@ snapshots:
'@types/react': 19.1.13
'@types/react-dom': 19.1.9(@types/react@19.1.13)
+ '@radix-ui/react-menubar@1.1.16(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-collection': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-compose-refs': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-context': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-direction': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-id': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-menu': 2.1.16(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-roving-focus': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/react@19.1.13)(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
'@radix-ui/react-navigation-menu@1.2.14(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
dependencies:
'@radix-ui/primitive': 1.1.3
@@ -12199,6 +12398,42 @@ snapshots:
'@types/react': 19.1.13
'@types/react-dom': 19.1.9(@types/react@19.1.13)
+ '@radix-ui/react-one-time-password-field@0.1.8(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/number': 1.1.1
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-collection': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-compose-refs': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-context': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-direction': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-roving-focus': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-effect-event': 0.0.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-is-hydrated': 0.1.0(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-layout-effect': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
+ '@radix-ui/react-password-toggle-field@0.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-context': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-id': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-effect-event': 0.0.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-is-hydrated': 0.1.0(@types/react@19.1.13)(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
'@radix-ui/react-popover@1.1.15(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
dependencies:
'@radix-ui/primitive': 1.1.3
@@ -12426,6 +12661,67 @@ snapshots:
'@types/react': 19.1.13
'@types/react-dom': 19.1.9(@types/react@19.1.13)
+ '@radix-ui/react-toast@1.2.15(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-collection': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-compose-refs': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-context': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-dismissable-layer': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-portal': 1.1.9(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-presence': 1.1.5(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-use-callback-ref': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-layout-effect': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-visually-hidden': 1.2.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
+ '@radix-ui/react-toggle-group@1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-context': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-direction': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-roving-focus': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-toggle': 1.1.10(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/react@19.1.13)(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
+ '@radix-ui/react-toggle@1.1.10(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/react@19.1.13)(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
+ '@radix-ui/react-toolbar@1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-context': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-direction': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-roving-focus': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-separator': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-toggle-group': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
'@radix-ui/react-tooltip@1.2.8(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)':
dependencies:
'@radix-ui/primitive': 1.1.3
@@ -18618,6 +18914,69 @@ snapshots:
quick-lru@5.1.1: {}
+ radix-ui@1.4.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1):
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-accessible-icon': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-accordion': 1.2.12(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-alert-dialog': 1.1.15(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-arrow': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-aspect-ratio': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-avatar': 1.1.10(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-checkbox': 1.3.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-collapsible': 1.1.12(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-collection': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-compose-refs': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-context': 1.1.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-context-menu': 2.2.16(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-dialog': 1.1.15(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-direction': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-dismissable-layer': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-dropdown-menu': 2.1.16(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-focus-guards': 1.1.3(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-focus-scope': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-form': 0.1.8(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-hover-card': 1.1.15(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-label': 2.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-menu': 2.1.16(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-menubar': 1.1.16(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-navigation-menu': 1.2.14(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-one-time-password-field': 0.1.8(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-password-toggle-field': 0.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-popover': 1.1.15(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-popper': 1.2.8(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-portal': 1.1.9(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-presence': 1.1.5(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-primitive': 2.1.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-progress': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-radio-group': 1.3.8(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-roving-focus': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-scroll-area': 1.2.10(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-select': 2.2.6(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-separator': 1.1.7(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-slider': 1.3.6(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-slot': 1.2.3(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-switch': 1.2.6(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-tabs': 1.1.13(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-toast': 1.2.15(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-toggle': 1.1.10(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-toggle-group': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-toolbar': 1.1.11(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-tooltip': 1.2.8(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ '@radix-ui/react-use-callback-ref': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-effect-event': 0.0.2(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-escape-keydown': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-is-hydrated': 0.1.0(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-layout-effect': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-use-size': 1.1.1(@types/react@19.1.13)(react@19.2.1)
+ '@radix-ui/react-visually-hidden': 1.2.3(@types/react-dom@19.1.9(@types/react@19.1.13))(@types/react@19.1.13)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)
+ react: 19.2.1
+ react-dom: 19.2.1(react@19.2.1)
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/react@19.1.13)
+
randombytes@2.1.0:
dependencies:
safe-buffer: 5.2.1