From a6da7308927dd55e54ff3f406f0655b465999536 Mon Sep 17 00:00:00 2001 From: Ai Khan <117706338+aikhanj@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:21:51 -0400 Subject: [PATCH 1/4] added test script --- .../engine/src/tests/mcp-verification.test.ts | 481 ++++++++++++++++++ 1 file changed, 481 insertions(+) create mode 100644 apps/engine/src/tests/mcp-verification.test.ts diff --git a/apps/engine/src/tests/mcp-verification.test.ts b/apps/engine/src/tests/mcp-verification.test.ts new file mode 100644 index 00000000..62b010fd --- /dev/null +++ b/apps/engine/src/tests/mcp-verification.test.ts @@ -0,0 +1,481 @@ +import { describe, test, expect, afterAll, beforeAll } from "bun:test"; +import type { FastifyInstance } from "fastify"; +import { getApp, closeApp } from "./setup"; +import { Client } from "pg"; +import "dotenv/config"; + +process.env.MCP_ACCESS_TOKEN = "test-mcp-token"; +process.env.MCP_MAX_SESSIONS_PER_CLIENT = "20"; +process.env.MCP_SESSION_TTL_MS = "1800000"; + +const MCP_HEADERS = { + "content-type": "application/json", + accept: "application/json, text/event-stream", + authorization: "Bearer test-mcp-token", +}; + +interface JsonRpcMessage { + jsonrpc: string; + id?: number; + result?: Record; + error?: { code: number; message: string }; +} + +function parseSSEMessages(body: string): JsonRpcMessage[] { + return body + .split("\n") + .filter((l: string) => l.startsWith("data: ")) + .map((l: string) => JSON.parse(l.slice(6))); +} + +async function initializeSessionAt( + app: FastifyInstance, + baseUrl: string, + extraHeaders: Record = {} +): Promise { + const res = await app.inject({ + method: "POST", + url: baseUrl, + headers: { ...MCP_HEADERS, ...extraHeaders }, + payload: { + jsonrpc: "2.0", + id: 1, + method: "initialize", + params: { + protocolVersion: "2025-03-26", + capabilities: {}, + clientInfo: { name: "test-client", version: "1.0.0" }, + }, + }, + }); + + const sessionId = res.headers["mcp-session-id"] as string; + await app.inject({ + method: "POST", + url: baseUrl, + headers: { ...MCP_HEADERS, ...extraHeaders, "mcp-session-id": sessionId }, + payload: { jsonrpc: "2.0", method: "notifications/initialized" }, + }); + return sessionId; +} + +async function callTool( + app: FastifyInstance, + baseUrl: string, + sessionId: string, + toolName: string, + args: Record, + extraHeaders: Record = {}, + rpcId = 10 +) { + const res = await app.inject({ + method: "POST", + url: baseUrl, + headers: { + ...MCP_HEADERS, + ...extraHeaders, + "mcp-session-id": sessionId, + "mcp-protocol-version": "2025-03-26", + }, + payload: { + jsonrpc: "2.0", + id: rpcId, + method: "tools/call", + params: { name: toolName, arguments: args }, + }, + }); + const messages = parseSSEMessages(res.body); + const callResponse = messages.find((m) => m.id === rpcId); + return { res, callResponse }; +} + +function extractToolText(callResponse: JsonRpcMessage | undefined): string { + const content = (callResponse?.result as Record)?.content as + | { type: string; text: string }[] + | undefined; + return content?.[0]?.text ?? ""; +} + +function extractToolIsError(callResponse: JsonRpcMessage | undefined): boolean { + return (callResponse?.result as Record)?.isError === true; +} + +// Seed test data into the local engine DB +let pgClient: Client; +let testUserId: number; +let testUser2Id: number; +let testScheduleId: number; +let testSchedule2Id: number; +let testCourseId: string; + +beforeAll(async () => { + pgClient = new Client({ connectionString: process.env.POSTGRES_URL }); + await pgClient.connect(); + + // Create two test users + const u1 = await pgClient.query( + "INSERT INTO users (email, netid, year) VALUES ('test1@princeton.edu', 'testuser1', 2026) RETURNING id" + ); + testUserId = u1.rows[0].id; + + const u2 = await pgClient.query( + "INSERT INTO users (email, netid, year) VALUES ('test2@princeton.edu', 'testuser2', 2026) RETURNING id" + ); + testUser2Id = u2.rows[0].id; + + // Create external_user_identities mappings + await pgClient.query( + "INSERT INTO external_user_identities (provider, external_user_id, engine_user_id, netid) VALUES ('supabase', 'ext-user-1', $1, 'testuser1')", + [testUserId] + ); + await pgClient.query( + "INSERT INTO external_user_identities (provider, external_user_id, engine_user_id, netid) VALUES ('supabase', 'ext-user-2', $1, 'testuser2')", + [testUser2Id] + ); + + // Pick a real course from the DB to use in tests + const courseRow = await pgClient.query( + "SELECT id, term FROM courses LIMIT 1" + ); + testCourseId = courseRow.rows[0].id; + const testTerm = courseRow.rows[0].term; + + // Create schedules for user 1 and user 2 + const s1 = await pgClient.query( + "INSERT INTO schedules (relative_id, user_id, title, term) VALUES (1, $1, 'Test Schedule', $2) RETURNING id", + [testUserId, testTerm] + ); + testScheduleId = s1.rows[0].id; + + const s2 = await pgClient.query( + "INSERT INTO schedules (relative_id, user_id, title, term) VALUES (1, $1, 'Other User Schedule', $2) RETURNING id", + [testUser2Id, testTerm] + ); + testSchedule2Id = s2.rows[0].id; + + // Add a course to user 1's schedule + await pgClient.query( + "INSERT INTO schedule_course_map (schedule_id, course_id, color) VALUES ($1, $2, 0)", + [testScheduleId, testCourseId] + ); +}); + +afterAll(async () => { + // Clean up test data + await pgClient.query("DELETE FROM schedule_course_map WHERE schedule_id = $1", [testScheduleId]); + await pgClient.query("DELETE FROM schedules WHERE id IN ($1, $2)", [testScheduleId, testSchedule2Id]); + await pgClient.query("DELETE FROM external_user_identities WHERE engine_user_id IN ($1, $2)", [testUserId, testUser2Id]); + await pgClient.query("DELETE FROM users WHERE id IN ($1, $2)", [testUserId, testUser2Id]); + await pgClient.end(); + await closeApp(); +}); + +// ─── 1. get_user_schedules returns correct schedules for authenticated user ─── +describe("Verification 1: get_user_schedules returns correct schedules", () => { + test("returns schedules for the authenticated user", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp", { + "x-external-user-id": "ext-user-1", + }); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "get_user_schedules", + { userId: testUserId }, + { "x-external-user-id": "ext-user-1" } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBe(false); + + const data = JSON.parse(extractToolText(callResponse)); + expect(data.count).toBeGreaterThanOrEqual(1); + const titles = data.schedules.map((s: { title: string }) => s.title); + expect(titles).toContain("Test Schedule"); + }); + + test("does NOT return other users' schedules", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp", { + "x-external-user-id": "ext-user-1", + }); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "get_user_schedules", + { userId: testUserId }, + { "x-external-user-id": "ext-user-1" } + ); + + const data = JSON.parse(extractToolText(callResponse)); + const titles = data.schedules.map((s: { title: string }) => s.title); + expect(titles).not.toContain("Other User Schedule"); + }); +}); + +// ─── 2. Schedule-course association has proper metadata (engine variant) ─────── +describe("Verification 2: get_schedule_details shows course association", () => { + test("schedule details include linked course", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp", { + "x-external-user-id": "ext-user-1", + }); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "get_schedule_details", + { scheduleId: testScheduleId }, + { "x-external-user-id": "ext-user-1" } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBe(false); + + const data = JSON.parse(extractToolText(callResponse)); + expect(data.schedule).toBeDefined(); + expect(data.schedule.title).toBe("Test Schedule"); + expect(data.courses.length).toBeGreaterThanOrEqual(1); + expect(data.courses[0].courseId).toBe(testCourseId); + }); +}); + +// ─── 3. find_courses_that_fit excludes conflicting courses (engine variant) ─── +describe("Verification 3: find_courses_that_fit excludes conflicting courses", () => { + test("returns courses that don't conflict with existing schedule", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp", { + "x-external-user-id": "ext-user-1", + }); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "find_courses_that_fit", + { scheduleId: testScheduleId, limit: 10 }, + { "x-external-user-id": "ext-user-1" } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBe(false); + + const data = JSON.parse(extractToolText(callResponse)); + expect(data.scheduleId).toBe(testScheduleId); + expect(data.courses).toBeDefined(); + expect(Array.isArray(data.courses)).toBe(true); + + // The course already in the schedule should NOT appear in results + const ids = data.courses.map((c: { id: string }) => c.id); + expect(ids).not.toContain(testCourseId); + }); +}); + +// ─── 4. Write tools reject operations on schedules not owned by the user ────── +describe("Verification 4: ownership enforcement on schedule tools", () => { + test("get_schedule_details rejects access to another user's schedule", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp", { + "x-external-user-id": "ext-user-1", + }); + + // User 1 tries to access User 2's schedule + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "get_schedule_details", + { scheduleId: testSchedule2Id }, + { "x-external-user-id": "ext-user-1" } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBe(true); + expect(extractToolText(callResponse)).toContain("Forbidden"); + }); + + test("get_user_schedules rejects request for another userId", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp", { + "x-external-user-id": "ext-user-1", + }); + + // User 1 tries to fetch User 2's schedules by passing user2's ID + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "get_user_schedules", + { userId: testUser2Id }, + { "x-external-user-id": "ext-user-1" } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBe(true); + expect(extractToolText(callResponse)).toContain("Forbidden"); + }); + + test("find_courses_that_fit rejects access to another user's schedule", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp", { + "x-external-user-id": "ext-user-1", + }); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "find_courses_that_fit", + { scheduleId: testSchedule2Id }, + { "x-external-user-id": "ext-user-1" } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBe(true); + expect(extractToolText(callResponse)).toContain("Forbidden"); + }); + + test("schedule tools blocked entirely without identity header", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp"); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "get_user_schedules", + { userId: testUserId } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBe(true); + expect(extractToolText(callResponse)).toContain("Missing authenticated user context"); + }); +}); + +// ─── 5. Non-schedule tools work without NetID ──────────────────────────────── +describe("Verification 5: non-schedule tools work without NetID", () => { + test("search_courses works without any identity headers", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp"); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "search_courses", + { limit: 5 } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBeFalsy(); + + const data = JSON.parse(extractToolText(callResponse)); + expect(data.courses).toBeDefined(); + expect(data.count).toBeGreaterThan(0); + }); + + test("list_departments works without any identity headers", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp"); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "list_departments", + {} + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBeFalsy(); + + const data = JSON.parse(extractToolText(callResponse)); + expect(data.departments).toBeDefined(); + expect(data.count).toBeGreaterThan(0); + }); + + test("search_instructors works without any identity headers", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp"); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "search_instructors", + { name: "a" } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBeFalsy(); + + const data = JSON.parse(extractToolText(callResponse)); + expect(data.instructors).toBeDefined(); + }); + + test("get_course_details works without any identity headers", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp"); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "get_course_details", + { courseId: testCourseId } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBeFalsy(); + + const data = JSON.parse(extractToolText(callResponse)); + expect(data.courseId).toBe(testCourseId); + expect(data.title).toBeDefined(); + }); + + test("list_terms works without any identity headers", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp"); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "list_terms", + {} + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBeFalsy(); + + const data = JSON.parse(extractToolText(callResponse)); + expect(data.terms).toBeDefined(); + expect(data.count).toBeGreaterThan(0); + }); + + test("get_course_sections works without any identity headers", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/mcp"); + + const { callResponse } = await callTool( + app, "/mcp", sessionId, + "get_course_sections", + { courseId: testCourseId } + ); + + expect(callResponse).toBeDefined(); + expect(extractToolIsError(callResponse)).toBeFalsy(); + + const data = JSON.parse(extractToolText(callResponse)); + expect(data.courseId).toBe(testCourseId); + expect(data.sections).toBeDefined(); + }); + + test("princetoncourses scope excludes schedule tools entirely", async () => { + const app = await getApp(); + const sessionId = await initializeSessionAt(app, "/princetoncourses/mcp"); + + const res = await app.inject({ + method: "POST", + url: "/princetoncourses/mcp", + headers: { + ...MCP_HEADERS, + "mcp-session-id": sessionId, + "mcp-protocol-version": "2025-03-26", + }, + payload: { jsonrpc: "2.0", id: 99, method: "tools/list" }, + }); + + const messages = parseSSEMessages(res.body); + const toolList = messages.find((m) => m.id === 99); + const tools = (toolList?.result as Record)?.tools as { name: string }[]; + const toolNames = tools.map((t) => t.name); + + expect(toolNames).toContain("search_courses"); + expect(toolNames).toContain("get_course_evaluations"); + expect(toolNames).toContain("search_instructors"); + expect(toolNames).not.toContain("get_user_schedules"); + expect(toolNames).not.toContain("get_schedule_details"); + expect(toolNames).not.toContain("find_courses_that_fit"); + }); +}); From 143cf60c5ffca3d98c0f09a839f62288d9b427a1 Mon Sep 17 00:00:00 2001 From: Ai Khan <117706338+aikhanj@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:29:12 -0400 Subject: [PATCH 2/4] removed schema mismatches by creating 1 migration --- ..._jones.sql => 0000_overjoyed_talkback.sql} | 18 +- apps/engine/drizzle/0001_mature_kingpin.sql | 2 - ...0002_replace_course_id_with_listing_id.sql | 5 - .../drizzle/0003_external_user_identities.sql | 16 - apps/engine/drizzle/meta/0000_snapshot.json | 272 ++++- apps/engine/drizzle/meta/0001_snapshot.json | 1014 ----------------- apps/engine/drizzle/meta/_journal.json | 18 +- .../engine/src/tests/mcp-verification.test.ts | 36 +- 8 files changed, 272 insertions(+), 1109 deletions(-) rename apps/engine/drizzle/{0000_deep_rick_jones.sql => 0000_overjoyed_talkback.sql} (88%) delete mode 100644 apps/engine/drizzle/0001_mature_kingpin.sql delete mode 100644 apps/engine/drizzle/0002_replace_course_id_with_listing_id.sql delete mode 100644 apps/engine/drizzle/0003_external_user_identities.sql delete mode 100644 apps/engine/drizzle/meta/0001_snapshot.json diff --git a/apps/engine/drizzle/0000_deep_rick_jones.sql b/apps/engine/drizzle/0000_overjoyed_talkback.sql similarity index 88% rename from apps/engine/drizzle/0000_deep_rick_jones.sql rename to apps/engine/drizzle/0000_overjoyed_talkback.sql index 96002fc0..10799ca4 100644 --- a/apps/engine/drizzle/0000_deep_rick_jones.sql +++ b/apps/engine/drizzle/0000_overjoyed_talkback.sql @@ -47,7 +47,8 @@ CREATE TABLE "departments" ( --> statement-breakpoint CREATE TABLE "evaluations" ( "id" serial PRIMARY KEY NOT NULL, - "course_id" text NOT NULL, + "listing_id" text NOT NULL, + "eval_term" text NOT NULL, "num_comments" integer, "comments" text[], "summary" text, @@ -56,6 +57,15 @@ CREATE TABLE "evaluations" ( "metadata" jsonb ); --> statement-breakpoint +CREATE TABLE "external_user_identities" ( + "id" serial PRIMARY KEY NOT NULL, + "provider" text NOT NULL, + "external_user_id" text NOT NULL, + "engine_user_id" integer NOT NULL, + "netid" text, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint CREATE TABLE "feedback" ( "id" serial PRIMARY KEY NOT NULL, "user_id" integer NOT NULL, @@ -137,7 +147,7 @@ ALTER TABLE "course_department_map" ADD CONSTRAINT "course_department_map_depart ALTER TABLE "course_instructor_map" ADD CONSTRAINT "course_instructor_map_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint ALTER TABLE "course_instructor_map" ADD CONSTRAINT "course_instructor_map_instructor_id_instructors_netid_fk" FOREIGN KEY ("instructor_id") REFERENCES "public"."instructors"("netid") ON DELETE no action ON UPDATE no action;--> statement-breakpoint ALTER TABLE "custom_events" ADD CONSTRAINT "custom_events_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "evaluations" ADD CONSTRAINT "evaluations_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "external_user_identities" ADD CONSTRAINT "external_user_identities_engine_user_id_users_id_fk" FOREIGN KEY ("engine_user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint ALTER TABLE "feedback" ADD CONSTRAINT "feedback_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint ALTER TABLE "icals" ADD CONSTRAINT "icals_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint ALTER TABLE "icals" ADD CONSTRAINT "icals_schedule_id_schedules_id_fk" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint @@ -146,4 +156,6 @@ ALTER TABLE "schedule_course_map" ADD CONSTRAINT "schedule_course_map_course_id_ ALTER TABLE "schedule_event_map" ADD CONSTRAINT "schedule_event_map_schedule_id_schedules_id_fk" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint ALTER TABLE "schedule_event_map" ADD CONSTRAINT "schedule_event_map_custom_event_id_custom_events_id_fk" FOREIGN KEY ("custom_event_id") REFERENCES "public"."custom_events"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint ALTER TABLE "schedules" ADD CONSTRAINT "schedules_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "sections" ADD CONSTRAINT "sections_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action; \ No newline at end of file +ALTER TABLE "sections" ADD CONSTRAINT "sections_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +CREATE UNIQUE INDEX "evaluations_listing_id_eval_term_idx" ON "evaluations" USING btree ("listing_id","eval_term");--> statement-breakpoint +CREATE UNIQUE INDEX "external_user_identities_provider_external_user_id_idx" ON "external_user_identities" USING btree ("provider","external_user_id"); \ No newline at end of file diff --git a/apps/engine/drizzle/0001_mature_kingpin.sql b/apps/engine/drizzle/0001_mature_kingpin.sql deleted file mode 100644 index d44f8763..00000000 --- a/apps/engine/drizzle/0001_mature_kingpin.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "evaluations" ADD COLUMN "eval_term" text NOT NULL;--> statement-breakpoint -CREATE UNIQUE INDEX "evaluations_course_id_eval_term_idx" ON "evaluations" USING btree ("course_id","eval_term"); \ No newline at end of file diff --git a/apps/engine/drizzle/0002_replace_course_id_with_listing_id.sql b/apps/engine/drizzle/0002_replace_course_id_with_listing_id.sql deleted file mode 100644 index de92e3c5..00000000 --- a/apps/engine/drizzle/0002_replace_course_id_with_listing_id.sql +++ /dev/null @@ -1,5 +0,0 @@ -DROP INDEX IF EXISTS "evaluations_course_id_eval_term_idx";--> statement-breakpoint -ALTER TABLE "evaluations" DROP CONSTRAINT IF EXISTS "evaluations_course_id_courses_id_fk";--> statement-breakpoint -ALTER TABLE "evaluations" DROP COLUMN IF EXISTS "course_id";--> statement-breakpoint -ALTER TABLE "evaluations" ADD COLUMN "listing_id" text NOT NULL;--> statement-breakpoint -CREATE UNIQUE INDEX "evaluations_listing_id_eval_term_idx" ON "evaluations" USING btree ("listing_id","eval_term"); diff --git a/apps/engine/drizzle/0003_external_user_identities.sql b/apps/engine/drizzle/0003_external_user_identities.sql deleted file mode 100644 index 86670137..00000000 --- a/apps/engine/drizzle/0003_external_user_identities.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE IF NOT EXISTS "external_user_identities" ( - "id" serial PRIMARY KEY NOT NULL, - "provider" text NOT NULL, - "external_user_id" text NOT NULL, - "engine_user_id" integer NOT NULL, - "netid" text, - "created_at" timestamp DEFAULT now() NOT NULL -);--> statement-breakpoint -ALTER TABLE "external_user_identities" - ADD CONSTRAINT "external_user_identities_engine_user_id_users_id_fk" - FOREIGN KEY ("engine_user_id") - REFERENCES "public"."users"("id") - ON DELETE no action - ON UPDATE no action;--> statement-breakpoint -CREATE UNIQUE INDEX IF NOT EXISTS "external_user_identities_provider_external_user_id_idx" - ON "external_user_identities" USING btree ("provider","external_user_id"); diff --git a/apps/engine/drizzle/meta/0000_snapshot.json b/apps/engine/drizzle/meta/0000_snapshot.json index b907a692..c23f9bb1 100644 --- a/apps/engine/drizzle/meta/0000_snapshot.json +++ b/apps/engine/drizzle/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "2342ba65-1079-404b-a097-d3637f25e9d3", + "id": "8465e618-3779-4ce5-ae8e-bffaff5708b8", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", @@ -53,8 +53,12 @@ "name": "analytics_user_id_users_id_fk", "tableFrom": "analytics", "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -88,8 +92,12 @@ "name": "course_department_map_course_id_courses_id_fk", "tableFrom": "course_department_map", "tableTo": "courses", - "columnsFrom": ["course_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" }, @@ -97,8 +105,12 @@ "name": "course_department_map_department_code_departments_code_fk", "tableFrom": "course_department_map", "tableTo": "departments", - "columnsFrom": ["department_code"], - "columnsTo": ["code"], + "columnsFrom": [ + "department_code" + ], + "columnsTo": [ + "code" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -106,7 +118,10 @@ "compositePrimaryKeys": { "course_department_map_course_id_department_code_pk": { "name": "course_department_map_course_id_department_code_pk", - "columns": ["course_id", "department_code"] + "columns": [ + "course_id", + "department_code" + ] } }, "uniqueConstraints": {}, @@ -137,8 +152,12 @@ "name": "course_instructor_map_course_id_courses_id_fk", "tableFrom": "course_instructor_map", "tableTo": "courses", - "columnsFrom": ["course_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" }, @@ -146,8 +165,12 @@ "name": "course_instructor_map_instructor_id_instructors_netid_fk", "tableFrom": "course_instructor_map", "tableTo": "instructors", - "columnsFrom": ["instructor_id"], - "columnsTo": ["netid"], + "columnsFrom": [ + "instructor_id" + ], + "columnsTo": [ + "netid" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -155,7 +178,10 @@ "compositePrimaryKeys": { "course_instructor_map_course_id_instructor_id_pk": { "name": "course_instructor_map_course_id_instructor_id_pk", - "columns": ["course_id", "instructor_id"] + "columns": [ + "course_id", + "instructor_id" + ] } }, "uniqueConstraints": {}, @@ -273,8 +299,12 @@ "name": "custom_events_user_id_users_id_fk", "tableFrom": "custom_events", "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -320,8 +350,14 @@ "primaryKey": true, "notNull": true }, - "course_id": { - "name": "course_id", + "listing_id": { + "name": "listing_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "eval_term": { + "name": "eval_term", "type": "text", "primaryKey": false, "notNull": true @@ -363,14 +399,112 @@ "notNull": false } }, - "indexes": {}, + "indexes": { + "evaluations_listing_id_eval_term_idx": { + "name": "evaluations_listing_id_eval_term_idx", + "columns": [ + { + "expression": "listing_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "eval_term", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.external_user_identities": { + "name": "external_user_identities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "external_user_id": { + "name": "external_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "engine_user_id": { + "name": "engine_user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "netid": { + "name": "netid", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "external_user_identities_provider_external_user_id_idx": { + "name": "external_user_identities_provider_external_user_id_idx", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, "foreignKeys": { - "evaluations_course_id_courses_id_fk": { - "name": "evaluations_course_id_courses_id_fk", - "tableFrom": "evaluations", - "tableTo": "courses", - "columnsFrom": ["course_id"], - "columnsTo": ["id"], + "external_user_identities_engine_user_id_users_id_fk": { + "name": "external_user_identities_engine_user_id_users_id_fk", + "tableFrom": "external_user_identities", + "tableTo": "users", + "columnsFrom": [ + "engine_user_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -424,8 +558,12 @@ "name": "feedback_user_id_users_id_fk", "tableFrom": "feedback", "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -471,8 +609,12 @@ "name": "icals_user_id_users_id_fk", "tableFrom": "icals", "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" }, @@ -480,8 +622,12 @@ "name": "icals_schedule_id_schedules_id_fk", "tableFrom": "icals", "tableTo": "schedules", - "columnsFrom": ["schedule_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -608,8 +754,12 @@ "name": "schedule_course_map_schedule_id_schedules_id_fk", "tableFrom": "schedule_course_map", "tableTo": "schedules", - "columnsFrom": ["schedule_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" }, @@ -617,8 +767,12 @@ "name": "schedule_course_map_course_id_courses_id_fk", "tableFrom": "schedule_course_map", "tableTo": "courses", - "columnsFrom": ["course_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -626,7 +780,10 @@ "compositePrimaryKeys": { "schedule_course_map_schedule_id_course_id_pk": { "name": "schedule_course_map_schedule_id_course_id_pk", - "columns": ["schedule_id", "course_id"] + "columns": [ + "schedule_id", + "course_id" + ] } }, "uniqueConstraints": {}, @@ -657,8 +814,12 @@ "name": "schedule_event_map_schedule_id_schedules_id_fk", "tableFrom": "schedule_event_map", "tableTo": "schedules", - "columnsFrom": ["schedule_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" }, @@ -666,8 +827,12 @@ "name": "schedule_event_map_custom_event_id_custom_events_id_fk", "tableFrom": "schedule_event_map", "tableTo": "custom_events", - "columnsFrom": ["custom_event_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "custom_event_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -675,7 +840,10 @@ "compositePrimaryKeys": { "schedule_event_map_schedule_id_custom_event_id_pk": { "name": "schedule_event_map_schedule_id_custom_event_id_pk", - "columns": ["schedule_id", "custom_event_id"] + "columns": [ + "schedule_id", + "custom_event_id" + ] } }, "uniqueConstraints": {}, @@ -731,8 +899,12 @@ "name": "schedules_user_id_users_id_fk", "tableFrom": "schedules", "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -822,8 +994,12 @@ "name": "sections_course_id_courses_id_fk", "tableFrom": "sections", "tableTo": "courses", - "columnsFrom": ["course_id"], - "columnsTo": ["id"], + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], "onDelete": "no action", "onUpdate": "no action" } @@ -890,7 +1066,11 @@ "public.status": { "name": "status", "schema": "public", - "values": ["open", "closed", "canceled"] + "values": [ + "open", + "closed", + "canceled" + ] } }, "schemas": {}, @@ -903,4 +1083,4 @@ "schemas": {}, "tables": {} } -} +} \ No newline at end of file diff --git a/apps/engine/drizzle/meta/0001_snapshot.json b/apps/engine/drizzle/meta/0001_snapshot.json deleted file mode 100644 index bc6f5e60..00000000 --- a/apps/engine/drizzle/meta/0001_snapshot.json +++ /dev/null @@ -1,1014 +0,0 @@ -{ - "id": "806403a5-4a7c-42f8-ba8f-5f0deb79ed2b", - "prevId": "2342ba65-1079-404b-a097-d3637f25e9d3", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.analytics": { - "name": "analytics", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page": { - "name": "page", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "analytics_user_id_users_id_fk": { - "name": "analytics_user_id_users_id_fk", - "tableFrom": "analytics", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.course_department_map": { - "name": "course_department_map", - "schema": "", - "columns": { - "course_id": { - "name": "course_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "department_code": { - "name": "department_code", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "course_department_map_course_id_courses_id_fk": { - "name": "course_department_map_course_id_courses_id_fk", - "tableFrom": "course_department_map", - "tableTo": "courses", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "course_department_map_department_code_departments_code_fk": { - "name": "course_department_map_department_code_departments_code_fk", - "tableFrom": "course_department_map", - "tableTo": "departments", - "columnsFrom": [ - "department_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "course_department_map_course_id_department_code_pk": { - "name": "course_department_map_course_id_department_code_pk", - "columns": [ - "course_id", - "department_code" - ] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.course_instructor_map": { - "name": "course_instructor_map", - "schema": "", - "columns": { - "course_id": { - "name": "course_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "instructor_id": { - "name": "instructor_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "course_instructor_map_course_id_courses_id_fk": { - "name": "course_instructor_map_course_id_courses_id_fk", - "tableFrom": "course_instructor_map", - "tableTo": "courses", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "course_instructor_map_instructor_id_instructors_netid_fk": { - "name": "course_instructor_map_instructor_id_instructors_netid_fk", - "tableFrom": "course_instructor_map", - "tableTo": "instructors", - "columnsFrom": [ - "instructor_id" - ], - "columnsTo": [ - "netid" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "course_instructor_map_course_id_instructor_id_pk": { - "name": "course_instructor_map_course_id_instructor_id_pk", - "columns": [ - "course_id", - "instructor_id" - ] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.courses": { - "name": "courses", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "listing_id": { - "name": "listing_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "term": { - "name": "term", - "type": "smallint", - "primaryKey": false, - "notNull": true - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "dists": { - "name": "dists", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "grading_basis": { - "name": "grading_basis", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "has_final": { - "name": "has_final", - "type": "boolean", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.custom_events": { - "name": "custom_events", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "times": { - "name": "times", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "custom_events_user_id_users_id_fk": { - "name": "custom_events_user_id_users_id_fk", - "tableFrom": "custom_events", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.departments": { - "name": "departments", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.evaluations": { - "name": "evaluations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "course_id": { - "name": "course_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "eval_term": { - "name": "eval_term", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "num_comments": { - "name": "num_comments", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "comments": { - "name": "comments", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rating": { - "name": "rating", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "rating_source": { - "name": "rating_source", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "evaluations_course_id_eval_term_idx": { - "name": "evaluations_course_id_eval_term_idx", - "columns": [ - { - "expression": "course_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "eval_term", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "evaluations_course_id_courses_id_fk": { - "name": "evaluations_course_id_courses_id_fk", - "tableFrom": "evaluations", - "tableTo": "courses", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.feedback": { - "name": "feedback", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "feedback": { - "name": "feedback", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_resolved": { - "name": "is_resolved", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "feedback_user_id_users_id_fk": { - "name": "feedback_user_id_users_id_fk", - "tableFrom": "feedback", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.icals": { - "name": "icals", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "schedule_id": { - "name": "schedule_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "icals_user_id_users_id_fk": { - "name": "icals_user_id_users_id_fk", - "tableFrom": "icals", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "icals_schedule_id_schedules_id_fk": { - "name": "icals_schedule_id_schedules_id_fk", - "tableFrom": "icals", - "tableTo": "schedules", - "columnsFrom": [ - "schedule_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.instructors": { - "name": "instructors", - "schema": "", - "columns": { - "netid": { - "name": "netid", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "emplid": { - "name": "emplid", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "full_name": { - "name": "full_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "department": { - "name": "department", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "office": { - "name": "office", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rating": { - "name": "rating", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "rating_uncertainty": { - "name": "rating_uncertainty", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "num_ratings": { - "name": "num_ratings", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.schedule_course_map": { - "name": "schedule_course_map", - "schema": "", - "columns": { - "schedule_id": { - "name": "schedule_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "course_id": { - "name": "course_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "color": { - "name": "color", - "type": "smallint", - "primaryKey": false, - "notNull": true - }, - "is_complete": { - "name": "is_complete", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "confirms": { - "name": "confirms", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - } - }, - "indexes": {}, - "foreignKeys": { - "schedule_course_map_schedule_id_schedules_id_fk": { - "name": "schedule_course_map_schedule_id_schedules_id_fk", - "tableFrom": "schedule_course_map", - "tableTo": "schedules", - "columnsFrom": [ - "schedule_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "schedule_course_map_course_id_courses_id_fk": { - "name": "schedule_course_map_course_id_courses_id_fk", - "tableFrom": "schedule_course_map", - "tableTo": "courses", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "schedule_course_map_schedule_id_course_id_pk": { - "name": "schedule_course_map_schedule_id_course_id_pk", - "columns": [ - "schedule_id", - "course_id" - ] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.schedule_event_map": { - "name": "schedule_event_map", - "schema": "", - "columns": { - "schedule_id": { - "name": "schedule_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "custom_event_id": { - "name": "custom_event_id", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "schedule_event_map_schedule_id_schedules_id_fk": { - "name": "schedule_event_map_schedule_id_schedules_id_fk", - "tableFrom": "schedule_event_map", - "tableTo": "schedules", - "columnsFrom": [ - "schedule_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "schedule_event_map_custom_event_id_custom_events_id_fk": { - "name": "schedule_event_map_custom_event_id_custom_events_id_fk", - "tableFrom": "schedule_event_map", - "tableTo": "custom_events", - "columnsFrom": [ - "custom_event_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "schedule_event_map_schedule_id_custom_event_id_pk": { - "name": "schedule_event_map_schedule_id_custom_event_id_pk", - "columns": [ - "schedule_id", - "custom_event_id" - ] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.schedules": { - "name": "schedules", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "relative_id": { - "name": "relative_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_public": { - "name": "is_public", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "term": { - "name": "term", - "type": "smallint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "schedules_user_id_users_id_fk": { - "name": "schedules_user_id_users_id_fk", - "tableFrom": "schedules", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sections": { - "name": "sections", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "course_id": { - "name": "course_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "num": { - "name": "num", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "room": { - "name": "room", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tot": { - "name": "tot", - "type": "smallint", - "primaryKey": false, - "notNull": true - }, - "cap": { - "name": "cap", - "type": "smallint", - "primaryKey": false, - "notNull": true - }, - "days": { - "name": "days", - "type": "smallint", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'open'" - } - }, - "indexes": {}, - "foreignKeys": { - "sections_course_id_courses_id_fk": { - "name": "sections_course_id_courses_id_fk", - "tableFrom": "sections", - "tableTo": "courses", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "netid": { - "name": "netid", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "year": { - "name": "year", - "type": "smallint", - "primaryKey": false, - "notNull": true - }, - "is_admin": { - "name": "is_admin", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "theme": { - "name": "theme", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "open", - "closed", - "canceled" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/apps/engine/drizzle/meta/_journal.json b/apps/engine/drizzle/meta/_journal.json index fe5ea024..22ad0817 100644 --- a/apps/engine/drizzle/meta/_journal.json +++ b/apps/engine/drizzle/meta/_journal.json @@ -5,22 +5,8 @@ { "idx": 0, "version": "7", - "when": 1761181940319, - "tag": "0000_deep_rick_jones", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1771560584355, - "tag": "0001_mature_kingpin", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1775000000000, - "tag": "0003_external_user_identities", + "when": 1774625025579, + "tag": "0000_overjoyed_talkback", "breakpoints": true } ] diff --git a/apps/engine/src/tests/mcp-verification.test.ts b/apps/engine/src/tests/mcp-verification.test.ts index 62b010fd..50f42915 100644 --- a/apps/engine/src/tests/mcp-verification.test.ts +++ b/apps/engine/src/tests/mcp-verification.test.ts @@ -133,12 +133,30 @@ beforeAll(async () => { [testUser2Id] ); - // Pick a real course from the DB to use in tests - const courseRow = await pgClient.query( - "SELECT id, term FROM courses LIMIT 1" + // Insert a minimal department + course + section for testing + await pgClient.query( + "INSERT INTO departments (code, name) VALUES ('TST', 'Test Department') ON CONFLICT DO NOTHING" + ); + testCourseId = "099999-1264"; + const testTerm = 1264; + await pgClient.query( + `INSERT INTO courses (id, listing_id, term, code, title, description, status, grading_basis) + VALUES ($1, '099999', $2, 'TST 100', 'Test Course', 'A test course for verification.', 'open', 'GRD') + ON CONFLICT DO NOTHING`, + [testCourseId, testTerm] + ); + await pgClient.query( + `INSERT INTO sections (course_id, title, num, tot, cap, days, start_time, end_time, status) + VALUES ($1, 'L01', '001', 0, 30, 5, 600, 680, 'open') + ON CONFLICT DO NOTHING`, + [testCourseId] + ); + await pgClient.query( + `INSERT INTO course_department_map (course_id, department_code) + VALUES ($1, 'TST') + ON CONFLICT DO NOTHING`, + [testCourseId] ); - testCourseId = courseRow.rows[0].id; - const testTerm = courseRow.rows[0].term; // Create schedules for user 1 and user 2 const s1 = await pgClient.query( @@ -161,11 +179,15 @@ beforeAll(async () => { }); afterAll(async () => { - // Clean up test data - await pgClient.query("DELETE FROM schedule_course_map WHERE schedule_id = $1", [testScheduleId]); + // Clean up test data (reverse FK order) + await pgClient.query("DELETE FROM schedule_course_map WHERE schedule_id IN ($1, $2)", [testScheduleId, testSchedule2Id]); await pgClient.query("DELETE FROM schedules WHERE id IN ($1, $2)", [testScheduleId, testSchedule2Id]); await pgClient.query("DELETE FROM external_user_identities WHERE engine_user_id IN ($1, $2)", [testUserId, testUser2Id]); await pgClient.query("DELETE FROM users WHERE id IN ($1, $2)", [testUserId, testUser2Id]); + await pgClient.query("DELETE FROM course_department_map WHERE course_id = $1", [testCourseId]); + await pgClient.query("DELETE FROM sections WHERE course_id = $1", [testCourseId]); + await pgClient.query("DELETE FROM courses WHERE id = $1", [testCourseId]); + await pgClient.query("DELETE FROM departments WHERE code = 'TST'"); await pgClient.end(); await closeApp(); }); From 30ee45e7cf589dc1d3333ccceaedec43753d155d Mon Sep 17 00:00:00 2001 From: Ai Khan <117706338+aikhanj@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:45:27 -0400 Subject: [PATCH 3/4] addded same migrations --- apps/engine/drizzle/0000_deep_rick_jones.sql | 149 +++ apps/engine/drizzle/0001_mature_kingpin.sql | 2 + ...0002_replace_course_id_with_listing_id.sql | 5 + .../drizzle/0003_external_user_identities.sql | 16 + apps/engine/drizzle/meta/0000_snapshot.json | 272 +---- apps/engine/drizzle/meta/0001_snapshot.json | 1014 +++++++++++++++++ apps/engine/drizzle/meta/_journal.json | 18 +- 7 files changed, 1248 insertions(+), 228 deletions(-) create mode 100644 apps/engine/drizzle/0000_deep_rick_jones.sql create mode 100644 apps/engine/drizzle/0001_mature_kingpin.sql create mode 100644 apps/engine/drizzle/0002_replace_course_id_with_listing_id.sql create mode 100644 apps/engine/drizzle/0003_external_user_identities.sql create mode 100644 apps/engine/drizzle/meta/0001_snapshot.json diff --git a/apps/engine/drizzle/0000_deep_rick_jones.sql b/apps/engine/drizzle/0000_deep_rick_jones.sql new file mode 100644 index 00000000..96002fc0 --- /dev/null +++ b/apps/engine/drizzle/0000_deep_rick_jones.sql @@ -0,0 +1,149 @@ +CREATE TYPE "public"."status" AS ENUM('open', 'closed', 'canceled');--> statement-breakpoint +CREATE TABLE "analytics" ( + "id" serial PRIMARY KEY NOT NULL, + "user_id" integer, + "event" text NOT NULL, + "page" text NOT NULL, + "metadata" jsonb DEFAULT '{}'::jsonb, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "course_department_map" ( + "course_id" text NOT NULL, + "department_code" text NOT NULL, + CONSTRAINT "course_department_map_course_id_department_code_pk" PRIMARY KEY("course_id","department_code") +); +--> statement-breakpoint +CREATE TABLE "course_instructor_map" ( + "course_id" text NOT NULL, + "instructor_id" text NOT NULL, + CONSTRAINT "course_instructor_map_course_id_instructor_id_pk" PRIMARY KEY("course_id","instructor_id") +); +--> statement-breakpoint +CREATE TABLE "courses" ( + "id" text PRIMARY KEY NOT NULL, + "listing_id" text NOT NULL, + "term" smallint NOT NULL, + "code" text NOT NULL, + "title" text NOT NULL, + "description" text NOT NULL, + "status" "status" DEFAULT 'open' NOT NULL, + "dists" text[], + "grading_basis" text NOT NULL, + "has_final" boolean +); +--> statement-breakpoint +CREATE TABLE "custom_events" ( + "id" serial PRIMARY KEY NOT NULL, + "user_id" integer NOT NULL, + "title" text NOT NULL, + "times" jsonb NOT NULL +); +--> statement-breakpoint +CREATE TABLE "departments" ( + "code" text PRIMARY KEY NOT NULL, + "name" text +); +--> statement-breakpoint +CREATE TABLE "evaluations" ( + "id" serial PRIMARY KEY NOT NULL, + "course_id" text NOT NULL, + "num_comments" integer, + "comments" text[], + "summary" text, + "rating" real, + "rating_source" text, + "metadata" jsonb +); +--> statement-breakpoint +CREATE TABLE "feedback" ( + "id" serial PRIMARY KEY NOT NULL, + "user_id" integer NOT NULL, + "feedback" text NOT NULL, + "is_resolved" boolean DEFAULT false NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "icals" ( + "id" serial PRIMARY KEY NOT NULL, + "user_id" integer NOT NULL, + "schedule_id" integer NOT NULL, + "url" text NOT NULL +); +--> statement-breakpoint +CREATE TABLE "instructors" ( + "netid" text PRIMARY KEY NOT NULL, + "emplid" text NOT NULL, + "name" text NOT NULL, + "full_name" text NOT NULL, + "department" text, + "email" text, + "office" text, + "rating" real, + "rating_uncertainty" real, + "num_ratings" integer +); +--> statement-breakpoint +CREATE TABLE "schedule_course_map" ( + "schedule_id" integer NOT NULL, + "course_id" text NOT NULL, + "color" smallint NOT NULL, + "is_complete" boolean DEFAULT false NOT NULL, + "confirms" jsonb DEFAULT '{}'::jsonb NOT NULL, + CONSTRAINT "schedule_course_map_schedule_id_course_id_pk" PRIMARY KEY("schedule_id","course_id") +); +--> statement-breakpoint +CREATE TABLE "schedule_event_map" ( + "schedule_id" integer NOT NULL, + "custom_event_id" integer NOT NULL, + CONSTRAINT "schedule_event_map_schedule_id_custom_event_id_pk" PRIMARY KEY("schedule_id","custom_event_id") +); +--> statement-breakpoint +CREATE TABLE "schedules" ( + "id" serial PRIMARY KEY NOT NULL, + "relative_id" integer NOT NULL, + "user_id" integer NOT NULL, + "title" text NOT NULL, + "is_public" boolean DEFAULT false NOT NULL, + "term" smallint NOT NULL +); +--> statement-breakpoint +CREATE TABLE "sections" ( + "id" serial PRIMARY KEY NOT NULL, + "course_id" text NOT NULL, + "title" text NOT NULL, + "num" text NOT NULL, + "room" text, + "tot" smallint NOT NULL, + "cap" smallint NOT NULL, + "days" smallint NOT NULL, + "start_time" integer NOT NULL, + "end_time" integer NOT NULL, + "status" "status" DEFAULT 'open' NOT NULL +); +--> statement-breakpoint +CREATE TABLE "users" ( + "id" serial PRIMARY KEY NOT NULL, + "email" text NOT NULL, + "netid" text NOT NULL, + "year" smallint NOT NULL, + "is_admin" boolean DEFAULT false NOT NULL, + "theme" jsonb DEFAULT '{}'::jsonb NOT NULL +); +--> statement-breakpoint +ALTER TABLE "analytics" ADD CONSTRAINT "analytics_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "course_department_map" ADD CONSTRAINT "course_department_map_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "course_department_map" ADD CONSTRAINT "course_department_map_department_code_departments_code_fk" FOREIGN KEY ("department_code") REFERENCES "public"."departments"("code") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "course_instructor_map" ADD CONSTRAINT "course_instructor_map_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "course_instructor_map" ADD CONSTRAINT "course_instructor_map_instructor_id_instructors_netid_fk" FOREIGN KEY ("instructor_id") REFERENCES "public"."instructors"("netid") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "custom_events" ADD CONSTRAINT "custom_events_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "evaluations" ADD CONSTRAINT "evaluations_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "feedback" ADD CONSTRAINT "feedback_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "icals" ADD CONSTRAINT "icals_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "icals" ADD CONSTRAINT "icals_schedule_id_schedules_id_fk" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "schedule_course_map" ADD CONSTRAINT "schedule_course_map_schedule_id_schedules_id_fk" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "schedule_course_map" ADD CONSTRAINT "schedule_course_map_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "schedule_event_map" ADD CONSTRAINT "schedule_event_map_schedule_id_schedules_id_fk" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "schedule_event_map" ADD CONSTRAINT "schedule_event_map_custom_event_id_custom_events_id_fk" FOREIGN KEY ("custom_event_id") REFERENCES "public"."custom_events"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "schedules" ADD CONSTRAINT "schedules_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "sections" ADD CONSTRAINT "sections_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action; \ No newline at end of file diff --git a/apps/engine/drizzle/0001_mature_kingpin.sql b/apps/engine/drizzle/0001_mature_kingpin.sql new file mode 100644 index 00000000..d44f8763 --- /dev/null +++ b/apps/engine/drizzle/0001_mature_kingpin.sql @@ -0,0 +1,2 @@ +ALTER TABLE "evaluations" ADD COLUMN "eval_term" text NOT NULL;--> statement-breakpoint +CREATE UNIQUE INDEX "evaluations_course_id_eval_term_idx" ON "evaluations" USING btree ("course_id","eval_term"); \ No newline at end of file diff --git a/apps/engine/drizzle/0002_replace_course_id_with_listing_id.sql b/apps/engine/drizzle/0002_replace_course_id_with_listing_id.sql new file mode 100644 index 00000000..de92e3c5 --- /dev/null +++ b/apps/engine/drizzle/0002_replace_course_id_with_listing_id.sql @@ -0,0 +1,5 @@ +DROP INDEX IF EXISTS "evaluations_course_id_eval_term_idx";--> statement-breakpoint +ALTER TABLE "evaluations" DROP CONSTRAINT IF EXISTS "evaluations_course_id_courses_id_fk";--> statement-breakpoint +ALTER TABLE "evaluations" DROP COLUMN IF EXISTS "course_id";--> statement-breakpoint +ALTER TABLE "evaluations" ADD COLUMN "listing_id" text NOT NULL;--> statement-breakpoint +CREATE UNIQUE INDEX "evaluations_listing_id_eval_term_idx" ON "evaluations" USING btree ("listing_id","eval_term"); diff --git a/apps/engine/drizzle/0003_external_user_identities.sql b/apps/engine/drizzle/0003_external_user_identities.sql new file mode 100644 index 00000000..86670137 --- /dev/null +++ b/apps/engine/drizzle/0003_external_user_identities.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS "external_user_identities" ( + "id" serial PRIMARY KEY NOT NULL, + "provider" text NOT NULL, + "external_user_id" text NOT NULL, + "engine_user_id" integer NOT NULL, + "netid" text, + "created_at" timestamp DEFAULT now() NOT NULL +);--> statement-breakpoint +ALTER TABLE "external_user_identities" + ADD CONSTRAINT "external_user_identities_engine_user_id_users_id_fk" + FOREIGN KEY ("engine_user_id") + REFERENCES "public"."users"("id") + ON DELETE no action + ON UPDATE no action;--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "external_user_identities_provider_external_user_id_idx" + ON "external_user_identities" USING btree ("provider","external_user_id"); diff --git a/apps/engine/drizzle/meta/0000_snapshot.json b/apps/engine/drizzle/meta/0000_snapshot.json index c23f9bb1..b907a692 100644 --- a/apps/engine/drizzle/meta/0000_snapshot.json +++ b/apps/engine/drizzle/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "8465e618-3779-4ce5-ae8e-bffaff5708b8", + "id": "2342ba65-1079-404b-a097-d3637f25e9d3", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", @@ -53,12 +53,8 @@ "name": "analytics_user_id_users_id_fk", "tableFrom": "analytics", "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -92,12 +88,8 @@ "name": "course_department_map_course_id_courses_id_fk", "tableFrom": "course_department_map", "tableTo": "courses", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["course_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -105,12 +97,8 @@ "name": "course_department_map_department_code_departments_code_fk", "tableFrom": "course_department_map", "tableTo": "departments", - "columnsFrom": [ - "department_code" - ], - "columnsTo": [ - "code" - ], + "columnsFrom": ["department_code"], + "columnsTo": ["code"], "onDelete": "no action", "onUpdate": "no action" } @@ -118,10 +106,7 @@ "compositePrimaryKeys": { "course_department_map_course_id_department_code_pk": { "name": "course_department_map_course_id_department_code_pk", - "columns": [ - "course_id", - "department_code" - ] + "columns": ["course_id", "department_code"] } }, "uniqueConstraints": {}, @@ -152,12 +137,8 @@ "name": "course_instructor_map_course_id_courses_id_fk", "tableFrom": "course_instructor_map", "tableTo": "courses", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["course_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -165,12 +146,8 @@ "name": "course_instructor_map_instructor_id_instructors_netid_fk", "tableFrom": "course_instructor_map", "tableTo": "instructors", - "columnsFrom": [ - "instructor_id" - ], - "columnsTo": [ - "netid" - ], + "columnsFrom": ["instructor_id"], + "columnsTo": ["netid"], "onDelete": "no action", "onUpdate": "no action" } @@ -178,10 +155,7 @@ "compositePrimaryKeys": { "course_instructor_map_course_id_instructor_id_pk": { "name": "course_instructor_map_course_id_instructor_id_pk", - "columns": [ - "course_id", - "instructor_id" - ] + "columns": ["course_id", "instructor_id"] } }, "uniqueConstraints": {}, @@ -299,12 +273,8 @@ "name": "custom_events_user_id_users_id_fk", "tableFrom": "custom_events", "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -350,14 +320,8 @@ "primaryKey": true, "notNull": true }, - "listing_id": { - "name": "listing_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "eval_term": { - "name": "eval_term", + "course_id": { + "name": "course_id", "type": "text", "primaryKey": false, "notNull": true @@ -399,112 +363,14 @@ "notNull": false } }, - "indexes": { - "evaluations_listing_id_eval_term_idx": { - "name": "evaluations_listing_id_eval_term_idx", - "columns": [ - { - "expression": "listing_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "eval_term", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.external_user_identities": { - "name": "external_user_identities", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "external_user_id": { - "name": "external_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "engine_user_id": { - "name": "engine_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "netid": { - "name": "netid", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "external_user_identities_provider_external_user_id_idx": { - "name": "external_user_identities_provider_external_user_id_idx", - "columns": [ - { - "expression": "provider", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "external_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, + "indexes": {}, "foreignKeys": { - "external_user_identities_engine_user_id_users_id_fk": { - "name": "external_user_identities_engine_user_id_users_id_fk", - "tableFrom": "external_user_identities", - "tableTo": "users", - "columnsFrom": [ - "engine_user_id" - ], - "columnsTo": [ - "id" - ], + "evaluations_course_id_courses_id_fk": { + "name": "evaluations_course_id_courses_id_fk", + "tableFrom": "evaluations", + "tableTo": "courses", + "columnsFrom": ["course_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -558,12 +424,8 @@ "name": "feedback_user_id_users_id_fk", "tableFrom": "feedback", "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -609,12 +471,8 @@ "name": "icals_user_id_users_id_fk", "tableFrom": "icals", "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -622,12 +480,8 @@ "name": "icals_schedule_id_schedules_id_fk", "tableFrom": "icals", "tableTo": "schedules", - "columnsFrom": [ - "schedule_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["schedule_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -754,12 +608,8 @@ "name": "schedule_course_map_schedule_id_schedules_id_fk", "tableFrom": "schedule_course_map", "tableTo": "schedules", - "columnsFrom": [ - "schedule_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["schedule_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -767,12 +617,8 @@ "name": "schedule_course_map_course_id_courses_id_fk", "tableFrom": "schedule_course_map", "tableTo": "courses", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["course_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -780,10 +626,7 @@ "compositePrimaryKeys": { "schedule_course_map_schedule_id_course_id_pk": { "name": "schedule_course_map_schedule_id_course_id_pk", - "columns": [ - "schedule_id", - "course_id" - ] + "columns": ["schedule_id", "course_id"] } }, "uniqueConstraints": {}, @@ -814,12 +657,8 @@ "name": "schedule_event_map_schedule_id_schedules_id_fk", "tableFrom": "schedule_event_map", "tableTo": "schedules", - "columnsFrom": [ - "schedule_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["schedule_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -827,12 +666,8 @@ "name": "schedule_event_map_custom_event_id_custom_events_id_fk", "tableFrom": "schedule_event_map", "tableTo": "custom_events", - "columnsFrom": [ - "custom_event_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["custom_event_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -840,10 +675,7 @@ "compositePrimaryKeys": { "schedule_event_map_schedule_id_custom_event_id_pk": { "name": "schedule_event_map_schedule_id_custom_event_id_pk", - "columns": [ - "schedule_id", - "custom_event_id" - ] + "columns": ["schedule_id", "custom_event_id"] } }, "uniqueConstraints": {}, @@ -899,12 +731,8 @@ "name": "schedules_user_id_users_id_fk", "tableFrom": "schedules", "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -994,12 +822,8 @@ "name": "sections_course_id_courses_id_fk", "tableFrom": "sections", "tableTo": "courses", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["course_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -1066,11 +890,7 @@ "public.status": { "name": "status", "schema": "public", - "values": [ - "open", - "closed", - "canceled" - ] + "values": ["open", "closed", "canceled"] } }, "schemas": {}, @@ -1083,4 +903,4 @@ "schemas": {}, "tables": {} } -} \ No newline at end of file +} diff --git a/apps/engine/drizzle/meta/0001_snapshot.json b/apps/engine/drizzle/meta/0001_snapshot.json new file mode 100644 index 00000000..bc6f5e60 --- /dev/null +++ b/apps/engine/drizzle/meta/0001_snapshot.json @@ -0,0 +1,1014 @@ +{ + "id": "806403a5-4a7c-42f8-ba8f-5f0deb79ed2b", + "prevId": "2342ba65-1079-404b-a097-d3637f25e9d3", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.analytics": { + "name": "analytics", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "event": { + "name": "event", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "page": { + "name": "page", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "analytics_user_id_users_id_fk": { + "name": "analytics_user_id_users_id_fk", + "tableFrom": "analytics", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.course_department_map": { + "name": "course_department_map", + "schema": "", + "columns": { + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "department_code": { + "name": "department_code", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "course_department_map_course_id_courses_id_fk": { + "name": "course_department_map_course_id_courses_id_fk", + "tableFrom": "course_department_map", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "course_department_map_department_code_departments_code_fk": { + "name": "course_department_map_department_code_departments_code_fk", + "tableFrom": "course_department_map", + "tableTo": "departments", + "columnsFrom": [ + "department_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "course_department_map_course_id_department_code_pk": { + "name": "course_department_map_course_id_department_code_pk", + "columns": [ + "course_id", + "department_code" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.course_instructor_map": { + "name": "course_instructor_map", + "schema": "", + "columns": { + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instructor_id": { + "name": "instructor_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "course_instructor_map_course_id_courses_id_fk": { + "name": "course_instructor_map_course_id_courses_id_fk", + "tableFrom": "course_instructor_map", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "course_instructor_map_instructor_id_instructors_netid_fk": { + "name": "course_instructor_map_instructor_id_instructors_netid_fk", + "tableFrom": "course_instructor_map", + "tableTo": "instructors", + "columnsFrom": [ + "instructor_id" + ], + "columnsTo": [ + "netid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "course_instructor_map_course_id_instructor_id_pk": { + "name": "course_instructor_map_course_id_instructor_id_pk", + "columns": [ + "course_id", + "instructor_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.courses": { + "name": "courses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "listing_id": { + "name": "listing_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "term": { + "name": "term", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "dists": { + "name": "dists", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "grading_basis": { + "name": "grading_basis", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "has_final": { + "name": "has_final", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.custom_events": { + "name": "custom_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "times": { + "name": "times", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "custom_events_user_id_users_id_fk": { + "name": "custom_events_user_id_users_id_fk", + "tableFrom": "custom_events", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.departments": { + "name": "departments", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.evaluations": { + "name": "evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "eval_term": { + "name": "eval_term", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "num_comments": { + "name": "num_comments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comments": { + "name": "comments", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "rating_source": { + "name": "rating_source", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "evaluations_course_id_eval_term_idx": { + "name": "evaluations_course_id_eval_term_idx", + "columns": [ + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "eval_term", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "evaluations_course_id_courses_id_fk": { + "name": "evaluations_course_id_courses_id_fk", + "tableFrom": "evaluations", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.feedback": { + "name": "feedback", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_resolved": { + "name": "is_resolved", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "feedback_user_id_users_id_fk": { + "name": "feedback_user_id_users_id_fk", + "tableFrom": "feedback", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.icals": { + "name": "icals", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "schedule_id": { + "name": "schedule_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "icals_user_id_users_id_fk": { + "name": "icals_user_id_users_id_fk", + "tableFrom": "icals", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "icals_schedule_id_schedules_id_fk": { + "name": "icals_schedule_id_schedules_id_fk", + "tableFrom": "icals", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.instructors": { + "name": "instructors", + "schema": "", + "columns": { + "netid": { + "name": "netid", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "emplid": { + "name": "emplid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "full_name": { + "name": "full_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "department": { + "name": "department", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "office": { + "name": "office", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "rating_uncertainty": { + "name": "rating_uncertainty", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "num_ratings": { + "name": "num_ratings", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedule_course_map": { + "name": "schedule_course_map", + "schema": "", + "columns": { + "schedule_id": { + "name": "schedule_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "is_complete": { + "name": "is_complete", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "confirms": { + "name": "confirms", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": { + "schedule_course_map_schedule_id_schedules_id_fk": { + "name": "schedule_course_map_schedule_id_schedules_id_fk", + "tableFrom": "schedule_course_map", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "schedule_course_map_course_id_courses_id_fk": { + "name": "schedule_course_map_course_id_courses_id_fk", + "tableFrom": "schedule_course_map", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "schedule_course_map_schedule_id_course_id_pk": { + "name": "schedule_course_map_schedule_id_course_id_pk", + "columns": [ + "schedule_id", + "course_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedule_event_map": { + "name": "schedule_event_map", + "schema": "", + "columns": { + "schedule_id": { + "name": "schedule_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "custom_event_id": { + "name": "custom_event_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "schedule_event_map_schedule_id_schedules_id_fk": { + "name": "schedule_event_map_schedule_id_schedules_id_fk", + "tableFrom": "schedule_event_map", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "schedule_event_map_custom_event_id_custom_events_id_fk": { + "name": "schedule_event_map_custom_event_id_custom_events_id_fk", + "tableFrom": "schedule_event_map", + "tableTo": "custom_events", + "columnsFrom": [ + "custom_event_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "schedule_event_map_schedule_id_custom_event_id_pk": { + "name": "schedule_event_map_schedule_id_custom_event_id_pk", + "columns": [ + "schedule_id", + "custom_event_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedules": { + "name": "schedules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "relative_id": { + "name": "relative_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "term": { + "name": "term", + "type": "smallint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "schedules_user_id_users_id_fk": { + "name": "schedules_user_id_users_id_fk", + "tableFrom": "schedules", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sections": { + "name": "sections", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "num": { + "name": "num", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "room": { + "name": "room", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tot": { + "name": "tot", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "cap": { + "name": "cap", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "days": { + "name": "days", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'open'" + } + }, + "indexes": {}, + "foreignKeys": { + "sections_course_id_courses_id_fk": { + "name": "sections_course_id_courses_id_fk", + "tableFrom": "sections", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "netid": { + "name": "netid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "year": { + "name": "year", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "is_admin": { + "name": "is_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "theme": { + "name": "theme", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.status": { + "name": "status", + "schema": "public", + "values": [ + "open", + "closed", + "canceled" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/engine/drizzle/meta/_journal.json b/apps/engine/drizzle/meta/_journal.json index 22ad0817..fe5ea024 100644 --- a/apps/engine/drizzle/meta/_journal.json +++ b/apps/engine/drizzle/meta/_journal.json @@ -5,8 +5,22 @@ { "idx": 0, "version": "7", - "when": 1774625025579, - "tag": "0000_overjoyed_talkback", + "when": 1761181940319, + "tag": "0000_deep_rick_jones", + "breakpoints": true + }, + { + "idx": 1, + "version": "7", + "when": 1771560584355, + "tag": "0001_mature_kingpin", + "breakpoints": true + }, + { + "idx": 2, + "version": "7", + "when": 1775000000000, + "tag": "0003_external_user_identities", "breakpoints": true } ] From 30bb32eeb15b8f0576237cc051b88d079f60baba Mon Sep 17 00:00:00 2001 From: Ai Khan <117706338+aikhanj@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:45:44 -0400 Subject: [PATCH 4/4] removed squashed migration --- .../drizzle/0000_overjoyed_talkback.sql | 161 --- apps/engine/drizzle/meta/0002_snapshot.json | 1000 +++++++++++++++ apps/engine/drizzle/meta/0003_snapshot.json | 1086 +++++++++++++++++ apps/engine/drizzle/meta/_journal.json | 9 +- 4 files changed, 2094 insertions(+), 162 deletions(-) delete mode 100644 apps/engine/drizzle/0000_overjoyed_talkback.sql create mode 100644 apps/engine/drizzle/meta/0002_snapshot.json create mode 100644 apps/engine/drizzle/meta/0003_snapshot.json diff --git a/apps/engine/drizzle/0000_overjoyed_talkback.sql b/apps/engine/drizzle/0000_overjoyed_talkback.sql deleted file mode 100644 index 10799ca4..00000000 --- a/apps/engine/drizzle/0000_overjoyed_talkback.sql +++ /dev/null @@ -1,161 +0,0 @@ -CREATE TYPE "public"."status" AS ENUM('open', 'closed', 'canceled');--> statement-breakpoint -CREATE TABLE "analytics" ( - "id" serial PRIMARY KEY NOT NULL, - "user_id" integer, - "event" text NOT NULL, - "page" text NOT NULL, - "metadata" jsonb DEFAULT '{}'::jsonb, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "course_department_map" ( - "course_id" text NOT NULL, - "department_code" text NOT NULL, - CONSTRAINT "course_department_map_course_id_department_code_pk" PRIMARY KEY("course_id","department_code") -); ---> statement-breakpoint -CREATE TABLE "course_instructor_map" ( - "course_id" text NOT NULL, - "instructor_id" text NOT NULL, - CONSTRAINT "course_instructor_map_course_id_instructor_id_pk" PRIMARY KEY("course_id","instructor_id") -); ---> statement-breakpoint -CREATE TABLE "courses" ( - "id" text PRIMARY KEY NOT NULL, - "listing_id" text NOT NULL, - "term" smallint NOT NULL, - "code" text NOT NULL, - "title" text NOT NULL, - "description" text NOT NULL, - "status" "status" DEFAULT 'open' NOT NULL, - "dists" text[], - "grading_basis" text NOT NULL, - "has_final" boolean -); ---> statement-breakpoint -CREATE TABLE "custom_events" ( - "id" serial PRIMARY KEY NOT NULL, - "user_id" integer NOT NULL, - "title" text NOT NULL, - "times" jsonb NOT NULL -); ---> statement-breakpoint -CREATE TABLE "departments" ( - "code" text PRIMARY KEY NOT NULL, - "name" text -); ---> statement-breakpoint -CREATE TABLE "evaluations" ( - "id" serial PRIMARY KEY NOT NULL, - "listing_id" text NOT NULL, - "eval_term" text NOT NULL, - "num_comments" integer, - "comments" text[], - "summary" text, - "rating" real, - "rating_source" text, - "metadata" jsonb -); ---> statement-breakpoint -CREATE TABLE "external_user_identities" ( - "id" serial PRIMARY KEY NOT NULL, - "provider" text NOT NULL, - "external_user_id" text NOT NULL, - "engine_user_id" integer NOT NULL, - "netid" text, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "feedback" ( - "id" serial PRIMARY KEY NOT NULL, - "user_id" integer NOT NULL, - "feedback" text NOT NULL, - "is_resolved" boolean DEFAULT false NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "icals" ( - "id" serial PRIMARY KEY NOT NULL, - "user_id" integer NOT NULL, - "schedule_id" integer NOT NULL, - "url" text NOT NULL -); ---> statement-breakpoint -CREATE TABLE "instructors" ( - "netid" text PRIMARY KEY NOT NULL, - "emplid" text NOT NULL, - "name" text NOT NULL, - "full_name" text NOT NULL, - "department" text, - "email" text, - "office" text, - "rating" real, - "rating_uncertainty" real, - "num_ratings" integer -); ---> statement-breakpoint -CREATE TABLE "schedule_course_map" ( - "schedule_id" integer NOT NULL, - "course_id" text NOT NULL, - "color" smallint NOT NULL, - "is_complete" boolean DEFAULT false NOT NULL, - "confirms" jsonb DEFAULT '{}'::jsonb NOT NULL, - CONSTRAINT "schedule_course_map_schedule_id_course_id_pk" PRIMARY KEY("schedule_id","course_id") -); ---> statement-breakpoint -CREATE TABLE "schedule_event_map" ( - "schedule_id" integer NOT NULL, - "custom_event_id" integer NOT NULL, - CONSTRAINT "schedule_event_map_schedule_id_custom_event_id_pk" PRIMARY KEY("schedule_id","custom_event_id") -); ---> statement-breakpoint -CREATE TABLE "schedules" ( - "id" serial PRIMARY KEY NOT NULL, - "relative_id" integer NOT NULL, - "user_id" integer NOT NULL, - "title" text NOT NULL, - "is_public" boolean DEFAULT false NOT NULL, - "term" smallint NOT NULL -); ---> statement-breakpoint -CREATE TABLE "sections" ( - "id" serial PRIMARY KEY NOT NULL, - "course_id" text NOT NULL, - "title" text NOT NULL, - "num" text NOT NULL, - "room" text, - "tot" smallint NOT NULL, - "cap" smallint NOT NULL, - "days" smallint NOT NULL, - "start_time" integer NOT NULL, - "end_time" integer NOT NULL, - "status" "status" DEFAULT 'open' NOT NULL -); ---> statement-breakpoint -CREATE TABLE "users" ( - "id" serial PRIMARY KEY NOT NULL, - "email" text NOT NULL, - "netid" text NOT NULL, - "year" smallint NOT NULL, - "is_admin" boolean DEFAULT false NOT NULL, - "theme" jsonb DEFAULT '{}'::jsonb NOT NULL -); ---> statement-breakpoint -ALTER TABLE "analytics" ADD CONSTRAINT "analytics_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "course_department_map" ADD CONSTRAINT "course_department_map_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "course_department_map" ADD CONSTRAINT "course_department_map_department_code_departments_code_fk" FOREIGN KEY ("department_code") REFERENCES "public"."departments"("code") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "course_instructor_map" ADD CONSTRAINT "course_instructor_map_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "course_instructor_map" ADD CONSTRAINT "course_instructor_map_instructor_id_instructors_netid_fk" FOREIGN KEY ("instructor_id") REFERENCES "public"."instructors"("netid") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "custom_events" ADD CONSTRAINT "custom_events_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "external_user_identities" ADD CONSTRAINT "external_user_identities_engine_user_id_users_id_fk" FOREIGN KEY ("engine_user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "feedback" ADD CONSTRAINT "feedback_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "icals" ADD CONSTRAINT "icals_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "icals" ADD CONSTRAINT "icals_schedule_id_schedules_id_fk" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "schedule_course_map" ADD CONSTRAINT "schedule_course_map_schedule_id_schedules_id_fk" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "schedule_course_map" ADD CONSTRAINT "schedule_course_map_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "schedule_event_map" ADD CONSTRAINT "schedule_event_map_schedule_id_schedules_id_fk" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "schedule_event_map" ADD CONSTRAINT "schedule_event_map_custom_event_id_custom_events_id_fk" FOREIGN KEY ("custom_event_id") REFERENCES "public"."custom_events"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "schedules" ADD CONSTRAINT "schedules_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "sections" ADD CONSTRAINT "sections_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -CREATE UNIQUE INDEX "evaluations_listing_id_eval_term_idx" ON "evaluations" USING btree ("listing_id","eval_term");--> statement-breakpoint -CREATE UNIQUE INDEX "external_user_identities_provider_external_user_id_idx" ON "external_user_identities" USING btree ("provider","external_user_id"); \ No newline at end of file diff --git a/apps/engine/drizzle/meta/0002_snapshot.json b/apps/engine/drizzle/meta/0002_snapshot.json new file mode 100644 index 00000000..cc2612ad --- /dev/null +++ b/apps/engine/drizzle/meta/0002_snapshot.json @@ -0,0 +1,1000 @@ +{ + "id": "0fc80ece-2d98-40c4-a26b-81aa32554ee5", + "prevId": "806403a5-4a7c-42f8-ba8f-5f0deb79ed2b", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.analytics": { + "name": "analytics", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "event": { + "name": "event", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "page": { + "name": "page", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "analytics_user_id_users_id_fk": { + "name": "analytics_user_id_users_id_fk", + "tableFrom": "analytics", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.course_department_map": { + "name": "course_department_map", + "schema": "", + "columns": { + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "department_code": { + "name": "department_code", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "course_department_map_course_id_courses_id_fk": { + "name": "course_department_map_course_id_courses_id_fk", + "tableFrom": "course_department_map", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "course_department_map_department_code_departments_code_fk": { + "name": "course_department_map_department_code_departments_code_fk", + "tableFrom": "course_department_map", + "tableTo": "departments", + "columnsFrom": [ + "department_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "course_department_map_course_id_department_code_pk": { + "name": "course_department_map_course_id_department_code_pk", + "columns": [ + "course_id", + "department_code" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.course_instructor_map": { + "name": "course_instructor_map", + "schema": "", + "columns": { + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instructor_id": { + "name": "instructor_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "course_instructor_map_course_id_courses_id_fk": { + "name": "course_instructor_map_course_id_courses_id_fk", + "tableFrom": "course_instructor_map", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "course_instructor_map_instructor_id_instructors_netid_fk": { + "name": "course_instructor_map_instructor_id_instructors_netid_fk", + "tableFrom": "course_instructor_map", + "tableTo": "instructors", + "columnsFrom": [ + "instructor_id" + ], + "columnsTo": [ + "netid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "course_instructor_map_course_id_instructor_id_pk": { + "name": "course_instructor_map_course_id_instructor_id_pk", + "columns": [ + "course_id", + "instructor_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.courses": { + "name": "courses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "listing_id": { + "name": "listing_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "term": { + "name": "term", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "dists": { + "name": "dists", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "grading_basis": { + "name": "grading_basis", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "has_final": { + "name": "has_final", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.custom_events": { + "name": "custom_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "times": { + "name": "times", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "custom_events_user_id_users_id_fk": { + "name": "custom_events_user_id_users_id_fk", + "tableFrom": "custom_events", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.departments": { + "name": "departments", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.evaluations": { + "name": "evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "listing_id": { + "name": "listing_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "eval_term": { + "name": "eval_term", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "num_comments": { + "name": "num_comments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comments": { + "name": "comments", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "rating_source": { + "name": "rating_source", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "evaluations_listing_id_eval_term_idx": { + "name": "evaluations_listing_id_eval_term_idx", + "columns": [ + { + "expression": "listing_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "eval_term", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.feedback": { + "name": "feedback", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_resolved": { + "name": "is_resolved", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "feedback_user_id_users_id_fk": { + "name": "feedback_user_id_users_id_fk", + "tableFrom": "feedback", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.icals": { + "name": "icals", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "schedule_id": { + "name": "schedule_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "icals_user_id_users_id_fk": { + "name": "icals_user_id_users_id_fk", + "tableFrom": "icals", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "icals_schedule_id_schedules_id_fk": { + "name": "icals_schedule_id_schedules_id_fk", + "tableFrom": "icals", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.instructors": { + "name": "instructors", + "schema": "", + "columns": { + "netid": { + "name": "netid", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "emplid": { + "name": "emplid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "full_name": { + "name": "full_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "department": { + "name": "department", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "office": { + "name": "office", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "rating_uncertainty": { + "name": "rating_uncertainty", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "num_ratings": { + "name": "num_ratings", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedule_course_map": { + "name": "schedule_course_map", + "schema": "", + "columns": { + "schedule_id": { + "name": "schedule_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "is_complete": { + "name": "is_complete", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "confirms": { + "name": "confirms", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": { + "schedule_course_map_schedule_id_schedules_id_fk": { + "name": "schedule_course_map_schedule_id_schedules_id_fk", + "tableFrom": "schedule_course_map", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "schedule_course_map_course_id_courses_id_fk": { + "name": "schedule_course_map_course_id_courses_id_fk", + "tableFrom": "schedule_course_map", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "schedule_course_map_schedule_id_course_id_pk": { + "name": "schedule_course_map_schedule_id_course_id_pk", + "columns": [ + "schedule_id", + "course_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedule_event_map": { + "name": "schedule_event_map", + "schema": "", + "columns": { + "schedule_id": { + "name": "schedule_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "custom_event_id": { + "name": "custom_event_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "schedule_event_map_schedule_id_schedules_id_fk": { + "name": "schedule_event_map_schedule_id_schedules_id_fk", + "tableFrom": "schedule_event_map", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "schedule_event_map_custom_event_id_custom_events_id_fk": { + "name": "schedule_event_map_custom_event_id_custom_events_id_fk", + "tableFrom": "schedule_event_map", + "tableTo": "custom_events", + "columnsFrom": [ + "custom_event_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "schedule_event_map_schedule_id_custom_event_id_pk": { + "name": "schedule_event_map_schedule_id_custom_event_id_pk", + "columns": [ + "schedule_id", + "custom_event_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedules": { + "name": "schedules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "relative_id": { + "name": "relative_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "term": { + "name": "term", + "type": "smallint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "schedules_user_id_users_id_fk": { + "name": "schedules_user_id_users_id_fk", + "tableFrom": "schedules", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sections": { + "name": "sections", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "num": { + "name": "num", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "room": { + "name": "room", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tot": { + "name": "tot", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "cap": { + "name": "cap", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "days": { + "name": "days", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'open'" + } + }, + "indexes": {}, + "foreignKeys": { + "sections_course_id_courses_id_fk": { + "name": "sections_course_id_courses_id_fk", + "tableFrom": "sections", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "netid": { + "name": "netid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "year": { + "name": "year", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "is_admin": { + "name": "is_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "theme": { + "name": "theme", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.status": { + "name": "status", + "schema": "public", + "values": [ + "open", + "closed", + "canceled" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/engine/drizzle/meta/0003_snapshot.json b/apps/engine/drizzle/meta/0003_snapshot.json new file mode 100644 index 00000000..872c5057 --- /dev/null +++ b/apps/engine/drizzle/meta/0003_snapshot.json @@ -0,0 +1,1086 @@ +{ + "id": "a222766a-172e-458f-bf17-a74dc6afcfd8", + "prevId": "0fc80ece-2d98-40c4-a26b-81aa32554ee5", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.analytics": { + "name": "analytics", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "event": { + "name": "event", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "page": { + "name": "page", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "analytics_user_id_users_id_fk": { + "name": "analytics_user_id_users_id_fk", + "tableFrom": "analytics", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.course_department_map": { + "name": "course_department_map", + "schema": "", + "columns": { + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "department_code": { + "name": "department_code", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "course_department_map_course_id_courses_id_fk": { + "name": "course_department_map_course_id_courses_id_fk", + "tableFrom": "course_department_map", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "course_department_map_department_code_departments_code_fk": { + "name": "course_department_map_department_code_departments_code_fk", + "tableFrom": "course_department_map", + "tableTo": "departments", + "columnsFrom": [ + "department_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "course_department_map_course_id_department_code_pk": { + "name": "course_department_map_course_id_department_code_pk", + "columns": [ + "course_id", + "department_code" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.course_instructor_map": { + "name": "course_instructor_map", + "schema": "", + "columns": { + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instructor_id": { + "name": "instructor_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "course_instructor_map_course_id_courses_id_fk": { + "name": "course_instructor_map_course_id_courses_id_fk", + "tableFrom": "course_instructor_map", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "course_instructor_map_instructor_id_instructors_netid_fk": { + "name": "course_instructor_map_instructor_id_instructors_netid_fk", + "tableFrom": "course_instructor_map", + "tableTo": "instructors", + "columnsFrom": [ + "instructor_id" + ], + "columnsTo": [ + "netid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "course_instructor_map_course_id_instructor_id_pk": { + "name": "course_instructor_map_course_id_instructor_id_pk", + "columns": [ + "course_id", + "instructor_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.courses": { + "name": "courses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "listing_id": { + "name": "listing_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "term": { + "name": "term", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "dists": { + "name": "dists", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "grading_basis": { + "name": "grading_basis", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "has_final": { + "name": "has_final", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.custom_events": { + "name": "custom_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "times": { + "name": "times", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "custom_events_user_id_users_id_fk": { + "name": "custom_events_user_id_users_id_fk", + "tableFrom": "custom_events", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.departments": { + "name": "departments", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.evaluations": { + "name": "evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "listing_id": { + "name": "listing_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "eval_term": { + "name": "eval_term", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "num_comments": { + "name": "num_comments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comments": { + "name": "comments", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "rating_source": { + "name": "rating_source", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "evaluations_listing_id_eval_term_idx": { + "name": "evaluations_listing_id_eval_term_idx", + "columns": [ + { + "expression": "listing_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "eval_term", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.external_user_identities": { + "name": "external_user_identities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "external_user_id": { + "name": "external_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "engine_user_id": { + "name": "engine_user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "netid": { + "name": "netid", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "external_user_identities_provider_external_user_id_idx": { + "name": "external_user_identities_provider_external_user_id_idx", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "external_user_identities_engine_user_id_users_id_fk": { + "name": "external_user_identities_engine_user_id_users_id_fk", + "tableFrom": "external_user_identities", + "tableTo": "users", + "columnsFrom": [ + "engine_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.feedback": { + "name": "feedback", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_resolved": { + "name": "is_resolved", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "feedback_user_id_users_id_fk": { + "name": "feedback_user_id_users_id_fk", + "tableFrom": "feedback", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.icals": { + "name": "icals", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "schedule_id": { + "name": "schedule_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "icals_user_id_users_id_fk": { + "name": "icals_user_id_users_id_fk", + "tableFrom": "icals", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "icals_schedule_id_schedules_id_fk": { + "name": "icals_schedule_id_schedules_id_fk", + "tableFrom": "icals", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.instructors": { + "name": "instructors", + "schema": "", + "columns": { + "netid": { + "name": "netid", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "emplid": { + "name": "emplid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "full_name": { + "name": "full_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "department": { + "name": "department", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "office": { + "name": "office", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "rating_uncertainty": { + "name": "rating_uncertainty", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "num_ratings": { + "name": "num_ratings", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedule_course_map": { + "name": "schedule_course_map", + "schema": "", + "columns": { + "schedule_id": { + "name": "schedule_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "is_complete": { + "name": "is_complete", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "confirms": { + "name": "confirms", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": { + "schedule_course_map_schedule_id_schedules_id_fk": { + "name": "schedule_course_map_schedule_id_schedules_id_fk", + "tableFrom": "schedule_course_map", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "schedule_course_map_course_id_courses_id_fk": { + "name": "schedule_course_map_course_id_courses_id_fk", + "tableFrom": "schedule_course_map", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "schedule_course_map_schedule_id_course_id_pk": { + "name": "schedule_course_map_schedule_id_course_id_pk", + "columns": [ + "schedule_id", + "course_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedule_event_map": { + "name": "schedule_event_map", + "schema": "", + "columns": { + "schedule_id": { + "name": "schedule_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "custom_event_id": { + "name": "custom_event_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "schedule_event_map_schedule_id_schedules_id_fk": { + "name": "schedule_event_map_schedule_id_schedules_id_fk", + "tableFrom": "schedule_event_map", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "schedule_event_map_custom_event_id_custom_events_id_fk": { + "name": "schedule_event_map_custom_event_id_custom_events_id_fk", + "tableFrom": "schedule_event_map", + "tableTo": "custom_events", + "columnsFrom": [ + "custom_event_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "schedule_event_map_schedule_id_custom_event_id_pk": { + "name": "schedule_event_map_schedule_id_custom_event_id_pk", + "columns": [ + "schedule_id", + "custom_event_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedules": { + "name": "schedules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "relative_id": { + "name": "relative_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "term": { + "name": "term", + "type": "smallint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "schedules_user_id_users_id_fk": { + "name": "schedules_user_id_users_id_fk", + "tableFrom": "schedules", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sections": { + "name": "sections", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "num": { + "name": "num", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "room": { + "name": "room", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tot": { + "name": "tot", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "cap": { + "name": "cap", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "days": { + "name": "days", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'open'" + } + }, + "indexes": {}, + "foreignKeys": { + "sections_course_id_courses_id_fk": { + "name": "sections_course_id_courses_id_fk", + "tableFrom": "sections", + "tableTo": "courses", + "columnsFrom": [ + "course_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "netid": { + "name": "netid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "year": { + "name": "year", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "is_admin": { + "name": "is_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "theme": { + "name": "theme", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.status": { + "name": "status", + "schema": "public", + "values": [ + "open", + "closed", + "canceled" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/engine/drizzle/meta/_journal.json b/apps/engine/drizzle/meta/_journal.json index fe5ea024..47e4b756 100644 --- a/apps/engine/drizzle/meta/_journal.json +++ b/apps/engine/drizzle/meta/_journal.json @@ -19,9 +19,16 @@ { "idx": 2, "version": "7", + "when": 1773000000000, + "tag": "0002_replace_course_id_with_listing_id", + "breakpoints": true + }, + { + "idx": 3, + "version": "7", "when": 1775000000000, "tag": "0003_external_user_identities", "breakpoints": true } ] -} \ No newline at end of file +}