diff --git a/apps/api/src/schema/websoc.ts b/apps/api/src/schema/websoc.ts index 367b11e8a..dabacb4ae 100644 --- a/apps/api/src/schema/websoc.ts +++ b/apps/api/src/schema/websoc.ts @@ -2,6 +2,7 @@ import { z } from "@hono/zod-openapi"; import type { FinalExamStatus } from "@packages/db/schema"; import { courseLevels, terms, websocSectionTypes, websocStatuses } from "@packages/db/schema"; import { isBaseTenInt } from "@packages/stdlib"; +import { aggregateGradeByCourseSchema, aggregateGradeByOfferingSchema } from "./grades"; import { courseNumberSchema, daysSchema, timeSchema, yearSchema } from "./lib"; const anyArray = ["ANY"] as const; @@ -95,11 +96,11 @@ export const websocQuerySchema = z.object({ }), courseNumber: courseNumberSchema.optional().openapi({ description: "Only include courses with the specified course number", - example: "45C", + example: "53", }), courseId: z.string().optional().openapi({ description: "Only include courses with the specified course ID", - example: "I&CSCI45C", + example: "I&CSCI53", }), sectionCodes: z .string() @@ -210,6 +211,11 @@ export const websocQuerySchema = z.object({ description: "Returns all sections from courses that contain at least one section matching your filters, even if those additional sections don't meet your existing filter criteria.", }), + includeGradesOfferingsLimit: z.coerce.number().int().nonnegative().max(100).optional().openapi({ + description: + "Include historical course and instructor grades for the first N returned sections, rounding up to include the entire last course. Omit or set to 0 to skip grades.", + example: 11, + }), }); export const hourMinuteSchema = z.object({ @@ -262,6 +268,30 @@ export const websocSectionSchema = z.object({ finalExam: websocSectionFinalExamSchema, sectionNum: z.string(), instructors: z.string().array(), + gradesByInstructor: z + .record(z.string(), aggregateGradeByOfferingSchema.nullable()) + .optional() + .openapi({ + description: + "Historical grade totals and GPA by section instructor. Null indicates no grades.", + example: { + "WONG-MA, J.": { + department: "I&C SCI", + courseNumber: "31", + instructor: "WONG-MA, J.", + gradeACount: 55, + gradeBCount: 24, + gradeCCount: 9, + gradeDCount: 2, + gradeFCount: 1, + gradePCount: 3, + gradeNPCount: 0, + gradeWCount: 1, + averageGPA: 3.41, + }, + STAFF: null, + }, + }), maxCapacity: z.string(), sectionCode: z.string(), sectionType: z.enum(websocSectionTypes), @@ -288,6 +318,9 @@ export const websocSectionSchema = z.object({ export const websocCourseSchema = z.object({ sections: websocSectionSchema.array(), + gradeDistribution: aggregateGradeByCourseSchema.nullable().optional().openapi({ + description: "Historical grade totals and GPA for the course across all instructors and terms.", + }), deptCode: z.string(), courseTitle: z.string(), courseNumber: z.string(), diff --git a/apps/api/src/services/grades.ts b/apps/api/src/services/grades.ts index 5ba6381ea..b820c0cde 100644 --- a/apps/api/src/services/grades.ts +++ b/apps/api/src/services/grades.ts @@ -1,6 +1,8 @@ import type { database } from "@packages/db"; import { and, avg, eq, gt, inArray, or, sql, sum } from "@packages/db/drizzle"; import { + gradeCourseSummary, + gradeOfferingSummary, websocCourse, websocSection, websocSectionGrade, @@ -13,6 +15,35 @@ import { buildCourseLevelQuery, buildGEQuery } from "./util.ts"; type GradesServiceInput = z.infer; +export const gradeCourseSelection = { + department: gradeCourseSummary.deptCode, + courseNumber: gradeCourseSummary.courseNumber, + gradeACount: gradeCourseSummary.gradeACount, + gradeBCount: gradeCourseSummary.gradeBCount, + gradeCCount: gradeCourseSummary.gradeCCount, + gradeDCount: gradeCourseSummary.gradeDCount, + gradeFCount: gradeCourseSummary.gradeFCount, + gradePCount: gradeCourseSummary.gradePCount, + gradeNPCount: gradeCourseSummary.gradeNPCount, + gradeWCount: gradeCourseSummary.gradeWCount, + averageGPA: gradeCourseSummary.averageGPA, +}; + +export const gradeOfferingSelection = { + department: gradeOfferingSummary.deptCode, + courseNumber: gradeOfferingSummary.courseNumber, + gradeACount: gradeOfferingSummary.gradeACount, + gradeBCount: gradeOfferingSummary.gradeBCount, + gradeCCount: gradeOfferingSummary.gradeCCount, + gradeDCount: gradeOfferingSummary.gradeDCount, + gradeFCount: gradeOfferingSummary.gradeFCount, + gradePCount: gradeOfferingSummary.gradePCount, + gradeNPCount: gradeOfferingSummary.gradeNPCount, + gradeWCount: gradeOfferingSummary.gradeWCount, + averageGPA: gradeOfferingSummary.averageGPA, + instructor: gradeOfferingSummary.instructorName, +}; + function buildQuery(input: GradesServiceInput) { const conditions = []; if (input.year) { @@ -256,6 +287,19 @@ export class GradesService { } async getAggregateGradesByCourse(input: GradesServiceInput) { + const { department, courseNumber, ...sectionFilters } = input; + if (!Object.values(sectionFilters).some(Boolean)) { + return this.db + .select(gradeCourseSelection) + .from(gradeCourseSummary) + .where( + and( + department ? eq(gradeCourseSummary.deptCode, department) : undefined, + courseNumber ? eq(gradeCourseSummary.courseNumber, courseNumber) : undefined, + ), + ); + } + return this.db .select({ department: websocCourse.deptCode, @@ -282,6 +326,21 @@ export class GradesService { } async getAggregateGradesByOffering(input: GradesServiceInput) { + const { department, courseNumber, instructor, ...sectionFilters } = input; + // The summary covers all-time results for named instructors. Unmapped sections appear as STAFF. + if (instructor && !Object.values(sectionFilters).some(Boolean)) { + return this.db + .select(gradeOfferingSelection) + .from(gradeOfferingSummary) + .where( + and( + eq(gradeOfferingSummary.instructorName, instructor), + department ? eq(gradeOfferingSummary.deptCode, department) : undefined, + courseNumber ? eq(gradeOfferingSummary.courseNumber, courseNumber) : undefined, + ), + ); + } + return this.db .select({ department: websocCourse.deptCode, diff --git a/apps/api/src/services/websoc.ts b/apps/api/src/services/websoc.ts index 0a3a41c44..31e1977f7 100644 --- a/apps/api/src/services/websoc.ts +++ b/apps/api/src/services/websoc.ts @@ -18,6 +18,8 @@ import { } from "@packages/db/drizzle"; import type { Term } from "@packages/db/schema"; import { + gradeCourseSummary, + gradeOfferingSummary, websocCourse, websocDepartment, websocInstructor, @@ -32,12 +34,15 @@ import { isFalse, isTrue, websocTermSortOrder } from "@packages/db/utils"; import { negativeAsNull } from "@packages/stdlib"; import type { z } from "zod"; import type { + aggregateGradeByCourseSchema, + aggregateGradeByOfferingSchema, syllabiQuerySchema, websocDepartmentsQuerySchema, websocQuerySchema, websocResponseSchema, websocSectionSchema, } from "$schema"; +import { gradeCourseSelection, gradeOfferingSelection } from "./grades.ts"; import { buildCourseLevelQuery, buildDaysOfWeekQuery, @@ -369,52 +374,45 @@ export class WebsocService { .from(websocSection) .where(inArray(websocSection.id, sectionIds)); const courseIds = [...new Set(sections.map((section) => section.courseId))]; - const courses = await this.db - .select() - .from(websocCourse) - .where(inArray(websocCourse.id, courseIds)); - const departmentIds = [...new Set(courses.map((course) => course.departmentId))]; - - // small enough to do together; avoid one more round trip - const departmentsAndSchools = await this.db + // fetch the hierarchy once per course to keep section rows small. + const courseHierarchy = await this.db .select({ + course: getTableColumns(websocCourse), department: getTableColumns(websocDepartment), school: getTableColumns(websocSchool), }) - .from(websocDepartment) + .from(websocCourse) + .innerJoin(websocDepartment, eq(websocCourse.departmentId, websocDepartment.id)) .innerJoin(websocSchool, eq(websocDepartment.schoolId, websocSchool.id)) - .where(inArray(websocDepartment.id, departmentIds)); + .where(inArray(websocCourse.id, courseIds)); - const schools: SchoolNode[] = []; const schoolById = new Map(); const departmentById = new Map(); + const courseById = new Map(); - for (const { department, school } of departmentsAndSchools) { - const departmentNode: DepartmentNode = { ...department, courses: [] }; - departmentById.set(department.id, departmentNode); - - if (!schoolById.has(school.id)) { - const schoolNode: SchoolNode = { ...school, departments: [departmentNode] }; - schools.push(schoolNode); - schoolById.set(school.id, schoolNode); - } else { - // just checked for inclusion - (schoolById.get(school.id) as SchoolNode).departments.push(departmentNode); + for (const { course, department, school } of courseHierarchy) { + let departmentNode = departmentById.get(department.id); + if (!departmentNode) { + let schoolNode = schoolById.get(school.id); + if (!schoolNode) { + schoolNode = { ...school, departments: [] }; + schoolById.set(school.id, schoolNode); + } + departmentNode = { ...department, courses: [] }; + departmentById.set(department.id, departmentNode); + schoolNode.departments.push(departmentNode); } - } - const courseById = new Map(); - for (const course of courses) { - const node: CourseNode = { ...course, sections: [] }; - courseById.set(course.id, node); - departmentById.get(course.departmentId)?.courses.push(node); + const courseNode: CourseNode = { ...course, sections: [] }; + courseById.set(course.id, courseNode); + departmentNode.courses.push(courseNode); } for (const section of sections) { courseById.get(section.courseId)?.sections.push(transformSection(section)); } - return { schools }; + return { schools: [...schoolById.values()] }; } async buildFromSingleQuery(input: WebsocServiceInput) { @@ -466,14 +464,124 @@ export class WebsocService { if (sectionsUpperBound === 0) { return { schools: [] }; - } else if (sectionsUpperBound < 1000) { - // we know the query will be small enough - return this.buildFromSingleQuery(input); - } else { - // we sometimes OOM on big (e.g. entire term) requests... - // do multiple queries to avoid thousands of copies of dept/school object coming from sql and being gc'd too slowly - const sectionIds = matchingSectionRows.map(({ sectionId }) => sectionId); - return this.buildFromRequeries(sectionIds); + } + + const response = + sectionsUpperBound < 1000 + ? // we know the query will be small enough + await this.buildFromSingleQuery(input) + : // we sometimes OOM on big (e.g. entire term) requests... + // do multiple queries to avoid thousands of copies of dept/school object coming from sql and being gc'd too slowly + await this.buildFromRequeries(matchingSectionRows.map(({ sectionId }) => sectionId)); + + if (input.includeGradesOfferingsLimit) { + await this.addGradeDistributions(response, input.includeGradesOfferingsLimit); + } + return response; + } + + private async addGradeDistributions( + response: z.infer, + sectionLimit: number, + ) { + const courses = response.schools.flatMap((school) => + school.departments.flatMap((department) => department.courses), + ); + const coursesWithGrades = []; + let remainingSections = sectionLimit; + for (const course of courses) { + if (remainingSections <= 0) break; + coursesWithGrades.push(course); + remainingSections -= course.sections.length; + } + if (!coursesWithGrades.length) return; + + const courseKey = (deptCode: string, courseNumber: string) => + JSON.stringify([deptCode, courseNumber]); + const offeringKey = (deptCode: string, courseNumber: string, instructorName: string) => + JSON.stringify([deptCode, courseNumber, instructorName]); + const courseKeys = new Map(); + const pairs = new Map< + string, + { dept_code: string; course_number: string; instructor_name: string } + >(); + + for (const { deptCode, courseNumber, sections } of coursesWithGrades) { + courseKeys.set(courseKey(deptCode, courseNumber), { + dept_code: deptCode, + course_number: courseNumber, + }); + for (const section of sections) { + for (const instructorName of section.instructors) { + pairs.set(offeringKey(deptCode, courseNumber, instructorName), { + dept_code: deptCode, + course_number: courseNumber, + instructor_name: instructorName, + }); + } + } + } + + const courseBatch = JSON.stringify([...courseKeys.values()]); + const requestedCourses = sql` + jsonb_to_recordset(${courseBatch}::jsonb) + as requested_courses(dept_code varchar, course_number varchar) + `; + const offeringBatch = JSON.stringify([...pairs.values()]); + const requestedOfferings = sql` + jsonb_to_recordset(${offeringBatch}::jsonb) + as pairs(dept_code varchar, course_number varchar, instructor_name varchar) + `; + + const courseRows = this.db + .select({ + ...gradeCourseSelection, + instructor: sql`null::varchar`, + }) + .from(requestedCourses) + .innerJoin( + gradeCourseSummary, + and( + eq(gradeCourseSummary.deptCode, sql`requested_courses.dept_code`), + eq(gradeCourseSummary.courseNumber, sql`requested_courses.course_number`), + ), + ); + const offeringRows = this.db + .select(gradeOfferingSelection) + .from(requestedOfferings) + .innerJoin( + gradeOfferingSummary, + and( + eq(gradeOfferingSummary.deptCode, sql`pairs.dept_code`), + eq(gradeOfferingSummary.courseNumber, sql`pairs.course_number`), + eq(gradeOfferingSummary.instructorName, sql`pairs.instructor_name`), + ), + ); + + const courseGrades = new Map>(); + const offeringGrades = new Map>(); + for (const { instructor, ...grade } of await courseRows.unionAll(offeringRows)) { + if (instructor === null) { + courseGrades.set(courseKey(grade.department, grade.courseNumber), grade); + } else { + offeringGrades.set(offeringKey(grade.department, grade.courseNumber, instructor), { + ...grade, + instructor, + }); + } + } + + for (const course of coursesWithGrades) { + const { deptCode, courseNumber } = course; + course.gradeDistribution = courseGrades.get(courseKey(deptCode, courseNumber)) ?? null; + for (const section of course.sections) { + section.gradesByInstructor = Object.fromEntries( + section.instructors.map((name) => [ + name, + offeringGrades.get(offeringKey(deptCode, courseNumber, name)) ?? null, + ]), + ); + } } } diff --git a/apps/data-pipeline/grades-importer/src/index.ts b/apps/data-pipeline/grades-importer/src/index.ts index d56cbbf42..a25a49883 100644 --- a/apps/data-pipeline/grades-importer/src/index.ts +++ b/apps/data-pipeline/grades-importer/src/index.ts @@ -1,9 +1,14 @@ import { readdirSync } from "node:fs"; import { exit } from "node:process"; import { database } from "@packages/db"; -import { and, eq, or } from "@packages/db/drizzle"; +import { and, eq, or, sql } from "@packages/db/drizzle"; import type { Term } from "@packages/db/schema"; -import { websocSection, websocSectionGrade } from "@packages/db/schema"; +import { + gradeCourseSummary, + gradeOfferingSummary, + websocSection, + websocSectionGrade, +} from "@packages/db/schema"; import { chunkUpsertData } from "@packages/db/utils"; import { getFromMapOrThrow } from "@packages/stdlib"; import xlsx from "node-xlsx"; @@ -95,11 +100,17 @@ async function main() { values.push({ sectionId: row.sectionId, ...data }); } await db.transaction(async (tx) => { + // lock so only one import can occur at a time + await tx.execute( + sql`select pg_advisory_xact_lock(hashtextextended('anteater:grade_offering_summary', 0))`, + ); const insertChunks = chunkUpsertData(websocSectionGrade, values); console.log(`split data into ${insertChunks.length} chunk(s) to insert`); for (const chunk of insertChunks) { await tx.insert(websocSectionGrade).values(chunk).onConflictDoNothing(); } + await tx.refreshMaterializedView(gradeOfferingSummary).concurrently(); + await tx.refreshMaterializedView(gradeCourseSummary).concurrently(); }); exit(0); } diff --git a/packages/db/drizzle.config.ts b/packages/db/drizzle.config.ts index 6a30b05dd..b948d62fa 100644 --- a/packages/db/drizzle.config.ts +++ b/packages/db/drizzle.config.ts @@ -3,7 +3,7 @@ import "dotenv/config"; import { defineConfig } from "drizzle-kit"; export default defineConfig({ - schema: "./src/schema/*.ts", + schema: "./src/schema/index.ts", out: "./migrations", dialect: "postgresql", }); diff --git a/packages/db/migrations/0042_grade_offering_summary.sql b/packages/db/migrations/0042_grade_offering_summary.sql new file mode 100644 index 000000000..de5a7265a --- /dev/null +++ b/packages/db/migrations/0042_grade_offering_summary.sql @@ -0,0 +1,43 @@ +CREATE MATERIALIZED VIEW "public"."grade_offering_summary" AS +SELECT + "websoc_course"."dept_code", + "websoc_course"."course_number", + "websoc_section_to_instructor"."instructor_name", + avg("websoc_section_grade"."average_gpa") AS "average_gpa", + sum("websoc_section_grade"."grade_a_count") AS "grade_a_count", + sum("websoc_section_grade"."grade_b_count") AS "grade_b_count", + sum("websoc_section_grade"."grade_c_count") AS "grade_c_count", + sum("websoc_section_grade"."grade_d_count") AS "grade_d_count", + sum("websoc_section_grade"."grade_f_count") AS "grade_f_count", + sum("websoc_section_grade"."grade_p_count") AS "grade_p_count", + sum("websoc_section_grade"."grade_np_count") AS "grade_np_count", + sum("websoc_section_grade"."grade_w_count") AS "grade_w_count" +FROM "websoc_section_grade" +JOIN "websoc_section" ON "websoc_section"."id" = "websoc_section_grade"."section_id" +JOIN "websoc_course" ON "websoc_course"."id" = "websoc_section"."course_id" +JOIN "websoc_section_to_instructor" ON "websoc_section_to_instructor"."section_id" = "websoc_section"."id" +GROUP BY "websoc_course"."dept_code", "websoc_course"."course_number", "websoc_section_to_instructor"."instructor_name"; +--> statement-breakpoint +CREATE UNIQUE INDEX "grade_offering_summary_offering_idx" +ON "public"."grade_offering_summary" ("dept_code", "course_number", "instructor_name"); +--> statement-breakpoint +CREATE MATERIALIZED VIEW "public"."grade_course_summary" AS +SELECT + "websoc_course"."dept_code", + "websoc_course"."course_number", + avg("websoc_section_grade"."average_gpa") AS "average_gpa", + sum("websoc_section_grade"."grade_a_count") AS "grade_a_count", + sum("websoc_section_grade"."grade_b_count") AS "grade_b_count", + sum("websoc_section_grade"."grade_c_count") AS "grade_c_count", + sum("websoc_section_grade"."grade_d_count") AS "grade_d_count", + sum("websoc_section_grade"."grade_f_count") AS "grade_f_count", + sum("websoc_section_grade"."grade_p_count") AS "grade_p_count", + sum("websoc_section_grade"."grade_np_count") AS "grade_np_count", + sum("websoc_section_grade"."grade_w_count") AS "grade_w_count" +FROM "websoc_section_grade" +JOIN "websoc_section" ON "websoc_section"."id" = "websoc_section_grade"."section_id" +JOIN "websoc_course" ON "websoc_course"."id" = "websoc_section"."course_id" +GROUP BY "websoc_course"."dept_code", "websoc_course"."course_number"; +--> statement-breakpoint +CREATE UNIQUE INDEX "grade_course_summary_course_idx" +ON "public"."grade_course_summary" ("dept_code", "course_number"); diff --git a/packages/db/migrations/meta/0042_snapshot.json b/packages/db/migrations/meta/0042_snapshot.json new file mode 100644 index 000000000..6a0b5a643 --- /dev/null +++ b/packages/db/migrations/meta/0042_snapshot.json @@ -0,0 +1,5385 @@ +{ + "id": "fce55df6-5fcf-4b05-a14f-114e6c914d2c", + "prevId": "95c8462e-62ba-44a2-8d28-d6b0e7b60c40", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.ap_exam": { + "name": "ap_exam", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "catalogue_name": { + "name": "catalogue_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ap_exam_reward": { + "name": "ap_exam_reward", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "units_granted": { + "name": "units_granted", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "elective_units_granted": { + "name": "elective_units_granted", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "ge_1a_courses_granted": { + "name": "ge_1a_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ge_1b_courses_granted": { + "name": "ge_1b_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ge_2_courses_granted": { + "name": "ge_2_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ge_3_courses_granted": { + "name": "ge_3_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ge_4_courses_granted": { + "name": "ge_4_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ge_5a_courses_granted": { + "name": "ge_5a_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ge_5b_courses_granted": { + "name": "ge_5b_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ge_6_courses_granted": { + "name": "ge_6_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ge_7_courses_granted": { + "name": "ge_7_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ge_8_courses_granted": { + "name": "ge_8_courses_granted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "courses_granted": { + "name": "courses_granted", + "type": "json", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ap_exam_to_reward": { + "name": "ap_exam_to_reward", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "exam_id": { + "name": "exam_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "score": { + "name": "score", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reward": { + "name": "reward", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "ap_exam_to_reward_exam_id_score_index": { + "name": "ap_exam_to_reward_exam_id_score_index", + "columns": [ + { + "expression": "exam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "score", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ap_exam_to_reward_exam_id_ap_exam_id_fk": { + "name": "ap_exam_to_reward_exam_id_ap_exam_id_fk", + "tableFrom": "ap_exam_to_reward", + "tableTo": "ap_exam", + "columnsFrom": ["exam_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ap_exam_to_reward_reward_ap_exam_reward_id_fk": { + "name": "ap_exam_to_reward_reward_ap_exam_reward_id_fk", + "tableFrom": "ap_exam_to_reward", + "tableTo": "ap_exam_reward", + "columnsFrom": ["reward"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.calendar_term": { + "name": "calendar_term", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true, + "generated": { + "as": "\"calendar_term\".\"year\" || ' ' || CASE WHEN \"calendar_term\".\"quarter\" = 'Fall' THEN 'Fall' WHEN \"calendar_term\".\"quarter\" = 'Winter' THEN 'Winter' WHEN \"calendar_term\".\"quarter\" = 'Spring' THEN 'Spring' WHEN \"calendar_term\".\"quarter\" = 'Summer1' THEN 'Summer1' WHEN \"calendar_term\".\"quarter\" = 'Summer10wk' THEN 'Summer10wk' WHEN \"calendar_term\".\"quarter\" = 'Summer2' THEN 'Summer2' ELSE '' END", + "type": "stored" + } + }, + "year": { + "name": "year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "quarter": { + "name": "quarter", + "type": "term", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "instruction_start": { + "name": "instruction_start", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "instruction_end": { + "name": "instruction_end", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "finals_start": { + "name": "finals_start", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "finals_end": { + "name": "finals_end", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "soc_available": { + "name": "soc_available", + "type": "date", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.course_material": { + "name": "course_material", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "section_id": { + "name": "section_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "isbn": { + "name": "isbn", + "type": "varchar[]", + "primaryKey": false, + "notNull": true, + "default": "ARRAY[]::VARCHAR[]" + }, + "author": { + "name": "author", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "edition": { + "name": "edition", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "format": { + "name": "format", + "type": "textbook_format", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "requirement": { + "name": "requirement", + "type": "material_requirement", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "mms_id": { + "name": "mms_id", + "type": "varchar[]", + "primaryKey": false, + "notNull": true, + "default": "ARRAY[]::VARCHAR[]" + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "course_material_section_id_index": { + "name": "course_material_section_id_index", + "columns": [ + { + "expression": "section_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "course_material_section_id_websoc_section_id_fk": { + "name": "course_material_section_id_websoc_section_id_fk", + "tableFrom": "course_material", + "tableTo": "websoc_section", + "columnsFrom": ["section_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.course": { + "name": "course", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "department": { + "name": "department", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "shortened_dept": { + "name": "shortened_dept", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "generated": { + "as": "REPLACE(\"course\".\"department\", ' ', '')", + "type": "stored" + } + }, + "department_alias": { + "name": "department_alias", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "course_number": { + "name": "course_number", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "course_numeric": { + "name": "course_numeric", + "type": "integer", + "primaryKey": false, + "notNull": true, + "generated": { + "as": "CASE REGEXP_REPLACE(\"course\".\"course_number\", '\\D', '', 'g') WHEN '' THEN 0 ELSE REGEXP_REPLACE(\"course\".\"course_number\", '\\D', '', 'g')::INTEGER END", + "type": "stored" + } + }, + "school": { + "name": "school", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "course_level": { + "name": "course_level", + "type": "course_level", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "min_units": { + "name": "min_units", + "type": "numeric(4, 2)", + "primaryKey": false, + "notNull": true + }, + "max_units": { + "name": "max_units", + "type": "numeric(4, 2)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "department_name": { + "name": "department_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "prerequisite_tree": { + "name": "prerequisite_tree", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "prerequisite_text": { + "name": "prerequisite_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "repeatability": { + "name": "repeatability", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "repeatability_times": { + "name": "repeatability_times", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "repeatability_type": { + "name": "repeatability_type", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "grading_option": { + "name": "grading_option", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "concurrent": { + "name": "concurrent", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "same_as": { + "name": "same_as", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "restriction": { + "name": "restriction", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "overlap": { + "name": "overlap", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "corequisites": { + "name": "corequisites", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_ge_1a": { + "name": "is_ge_1a", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_1b": { + "name": "is_ge_1b", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_2": { + "name": "is_ge_2", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_3": { + "name": "is_ge_3", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_4": { + "name": "is_ge_4", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_5a": { + "name": "is_ge_5a", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_5b": { + "name": "is_ge_5b", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_6": { + "name": "is_ge_6", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_7": { + "name": "is_ge_7", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_8": { + "name": "is_ge_8", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "ge_text": { + "name": "ge_text", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "course_search_index": { + "name": "course_search_index", + "columns": [ + { + "expression": "(\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"id\", '')), 'A') ||\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"department\", '')), 'B') ||\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"department_alias\", '')), 'B') ||\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"shortened_dept\", '')), 'B') ||\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"course_number\", '')), 'B') ||\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"course_numeric\"::TEXT, '')), 'B') ||\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"title\", '')), 'C') ||\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"description\", '')), 'D')\n)", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "shortened_dept": { + "name": "shortened_dept", + "columns": [ + { + "expression": "shortened_dept", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.prerequisite": { + "name": "prerequisite", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "dep_dept": { + "name": "dep_dept", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "prerequisite_id": { + "name": "prerequisite_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "dependency_id": { + "name": "dependency_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "prerequisite_dep_dept_index": { + "name": "prerequisite_dep_dept_index", + "columns": [ + { + "expression": "dep_dept", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "prerequisite_prerequisite_id_index": { + "name": "prerequisite_prerequisite_id_index", + "columns": [ + { + "expression": "prerequisite_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "prerequisite_dependency_id_index": { + "name": "prerequisite_dependency_id_index", + "columns": [ + { + "expression": "dependency_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "prerequisite_prerequisite_id_dependency_id_index": { + "name": "prerequisite_prerequisite_id_dependency_id_index", + "columns": [ + { + "expression": "prerequisite_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "dependency_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_degree": { + "name": "dw_degree", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "division": { + "name": "division", + "type": "division", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_major": { + "name": "dw_major", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "degree_id": { + "name": "degree_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dw_major_degree_id_index": { + "name": "dw_major_degree_id_index", + "columns": [ + { + "expression": "degree_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dw_major_degree_id_dw_degree_id_fk": { + "name": "dw_major_degree_id_dw_degree_id_fk", + "tableFrom": "dw_major", + "tableTo": "dw_degree", + "columnsFrom": ["degree_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_major_requirement": { + "name": "dw_major_requirement", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "generated": { + "as": "jsonb_hash_extended(requirements, 0)", + "type": "stored" + } + }, + "header": { + "name": "header", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "requirements": { + "name": "requirements", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_major_specialization_to_requirement": { + "name": "dw_major_specialization_to_requirement", + "schema": "", + "columns": { + "major_id": { + "name": "major_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "specialization_id": { + "name": "specialization_id", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "catalog_year": { + "name": "catalog_year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "requirement_id": { + "name": "requirement_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dw_major_specialization_to_requirement_catalog_year_index": { + "name": "dw_major_specialization_to_requirement_catalog_year_index", + "columns": [ + { + "expression": "catalog_year", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dw_major_specialization_to_requirement_major_id_dw_major_id_fk": { + "name": "dw_major_specialization_to_requirement_major_id_dw_major_id_fk", + "tableFrom": "dw_major_specialization_to_requirement", + "tableTo": "dw_major", + "columnsFrom": ["major_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "dw_major_specialization_to_requirement_specialization_id_dw_specialization_id_fk": { + "name": "dw_major_specialization_to_requirement_specialization_id_dw_specialization_id_fk", + "tableFrom": "dw_major_specialization_to_requirement", + "tableTo": "dw_specialization", + "columnsFrom": ["specialization_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "dw_major_specialization_to_requirement_requirement_id_dw_major_requirement_id_fk": { + "name": "dw_major_specialization_to_requirement_requirement_id_dw_major_requirement_id_fk", + "tableFrom": "dw_major_specialization_to_requirement", + "tableTo": "dw_major_requirement", + "columnsFrom": ["requirement_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "dw_major_specialization_to_requirement_major_id_specialization_id_catalog_year_unique": { + "name": "dw_major_specialization_to_requirement_major_id_specialization_id_catalog_year_unique", + "nullsNotDistinct": true, + "columns": ["major_id", "specialization_id", "catalog_year"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_major_year": { + "name": "dw_major_year", + "schema": "", + "columns": { + "program_id": { + "name": "program_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "catalog_year": { + "name": "catalog_year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "specialization_required": { + "name": "specialization_required", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "college_requirements_title": { + "name": "college_requirements_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "college_header": { + "name": "college_header", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "college_requirements": { + "name": "college_requirements", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "dw_major_year_program_id_catalog_year_index": { + "name": "dw_major_year_program_id_catalog_year_index", + "columns": [ + { + "expression": "program_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "catalog_year", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "dw_major_year_catalog_year_index": { + "name": "dw_major_year_catalog_year_index", + "columns": [ + { + "expression": "catalog_year", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dw_major_year_program_id_dw_major_id_fk": { + "name": "dw_major_year_program_id_dw_major_id_fk", + "tableFrom": "dw_major_year", + "tableTo": "dw_major", + "columnsFrom": ["program_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_minor": { + "name": "dw_minor", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_minor_requirement": { + "name": "dw_minor_requirement", + "schema": "", + "columns": { + "program_id": { + "name": "program_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "catalog_year": { + "name": "catalog_year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "requirements": { + "name": "requirements", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dw_minor_requirement_program_id_catalog_year_index": { + "name": "dw_minor_requirement_program_id_catalog_year_index", + "columns": [ + { + "expression": "program_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "catalog_year", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "dw_minor_requirement_catalog_year_index": { + "name": "dw_minor_requirement_catalog_year_index", + "columns": [ + { + "expression": "catalog_year", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dw_minor_requirement_program_id_dw_minor_id_fk": { + "name": "dw_minor_requirement_program_id_dw_minor_id_fk", + "tableFrom": "dw_minor_requirement", + "tableTo": "dw_minor", + "columnsFrom": ["program_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_school_requirement": { + "name": "dw_school_requirement", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "catalog_year": { + "name": "catalog_year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "requirements": { + "name": "requirements", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dw_school_requirement_id_catalog_year_index": { + "name": "dw_school_requirement_id_catalog_year_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "catalog_year", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_specialization": { + "name": "dw_specialization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "major_id": { + "name": "major_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dw_specialization_major_id_index": { + "name": "dw_specialization_major_id_index", + "columns": [ + { + "expression": "major_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dw_specialization_major_id_dw_major_id_fk": { + "name": "dw_specialization_major_id_dw_major_id_fk", + "tableFrom": "dw_specialization", + "tableTo": "dw_major", + "columnsFrom": ["major_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dw_specialization_requirement": { + "name": "dw_specialization_requirement", + "schema": "", + "columns": { + "program_id": { + "name": "program_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "catalog_year": { + "name": "catalog_year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "requirements": { + "name": "requirements", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dw_specialization_requirement_program_id_catalog_year_index": { + "name": "dw_specialization_requirement_program_id_catalog_year_index", + "columns": [ + { + "expression": "program_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "catalog_year", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "dw_specialization_requirement_catalog_year_index": { + "name": "dw_specialization_requirement_catalog_year_index", + "columns": [ + { + "expression": "catalog_year", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dw_specialization_requirement_program_id_dw_specialization_id_fk": { + "name": "dw_specialization_requirement_program_id_dw_specialization_id_fk", + "tableFrom": "dw_specialization_requirement", + "tableTo": "dw_specialization", + "columnsFrom": ["program_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_diet_restriction": { + "name": "dining_diet_restriction", + "schema": "", + "columns": { + "dish_id": { + "name": "dish_id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "contains_eggs": { + "name": "contains_eggs", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "contains_fish": { + "name": "contains_fish", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "contains_milk": { + "name": "contains_milk", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "contains_peanuts": { + "name": "contains_peanuts", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "contains_sesame": { + "name": "contains_sesame", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "contains_shellfish": { + "name": "contains_shellfish", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "contains_soy": { + "name": "contains_soy", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "contains_tree_nuts": { + "name": "contains_tree_nuts", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "contains_wheat": { + "name": "contains_wheat", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_gluten_free": { + "name": "is_gluten_free", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_halal": { + "name": "is_halal", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_kosher": { + "name": "is_kosher", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_locally_grown": { + "name": "is_locally_grown", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_organic": { + "name": "is_organic", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_vegan": { + "name": "is_vegan", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_vegetarian": { + "name": "is_vegetarian", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "dining_diet_restriction_dish_id_dining_dish_id_fk": { + "name": "dining_diet_restriction_dish_id_dining_dish_id_fk", + "tableFrom": "dining_diet_restriction", + "tableTo": "dining_dish", + "columnsFrom": ["dish_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_dish": { + "name": "dining_dish", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "station_id": { + "name": "station_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "ingredients": { + "name": "ingredients", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "category": { + "name": "category", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "image_url": { + "name": "image_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dining_dish_station_id_index": { + "name": "dining_dish_station_id_index", + "columns": [ + { + "expression": "station_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dining_dish_station_id_dining_station_id_fk": { + "name": "dining_dish_station_id_dining_station_id_fk", + "tableFrom": "dining_dish", + "tableTo": "dining_station", + "columnsFrom": ["station_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_dish_to_period": { + "name": "dining_dish_to_period", + "schema": "", + "columns": { + "period_id": { + "name": "period_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "dish_id": { + "name": "dish_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "is_first": { + "name": "is_first", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "dining_dish_to_period_period_id_dining_period_id_fk": { + "name": "dining_dish_to_period_period_id_dining_period_id_fk", + "tableFrom": "dining_dish_to_period", + "tableTo": "dining_period", + "columnsFrom": ["period_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "dining_dish_to_period_dish_id_dining_dish_id_fk": { + "name": "dining_dish_to_period_dish_id_dining_dish_id_fk", + "tableFrom": "dining_dish_to_period", + "tableTo": "dining_dish", + "columnsFrom": ["dish_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_event": { + "name": "dining_event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "image": { + "name": "image", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "restaurant_id": { + "name": "restaurant_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "start": { + "name": "start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "end": { + "name": "end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dining_event_restaurant_id_title_index": { + "name": "dining_event_restaurant_id_title_index", + "columns": [ + { + "expression": "restaurant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "title", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"dining_event\".\"start\" is null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dining_event_restaurant_id_dining_restaurant_id_fk": { + "name": "dining_event_restaurant_id_dining_restaurant_id_fk", + "tableFrom": "dining_event", + "tableTo": "dining_restaurant", + "columnsFrom": ["restaurant_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_meal_period_type": { + "name": "dining_meal_period_type", + "schema": "", + "columns": { + "adobe_id": { + "name": "adobe_id", + "type": "integer", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_nutrition_info": { + "name": "dining_nutrition_info", + "schema": "", + "columns": { + "dish_id": { + "name": "dish_id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "serving_size": { + "name": "serving_size", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "serving_unit": { + "name": "serving_unit", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "calories": { + "name": "calories", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_fat_g": { + "name": "total_fat_g", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "trans_fat_g": { + "name": "trans_fat_g", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "saturated_fat_g": { + "name": "saturated_fat_g", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "cholesterol_mg": { + "name": "cholesterol_mg", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "sodium_mg": { + "name": "sodium_mg", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_carbs_g": { + "name": "total_carbs_g", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "dietary_fiber_g": { + "name": "dietary_fiber_g", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "sugars_g": { + "name": "sugars_g", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "protein_g": { + "name": "protein_g", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "calcium": { + "name": "calcium", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "iron": { + "name": "iron", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "vitamin_a": { + "name": "vitamin_a", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "vitamin_c": { + "name": "vitamin_c", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "dining_nutrition_info_dish_id_dining_dish_id_fk": { + "name": "dining_nutrition_info_dish_id_dining_dish_id_fk", + "tableFrom": "dining_nutrition_info", + "tableTo": "dining_dish", + "columnsFrom": ["dish_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_period": { + "name": "dining_period", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "meal_period_type_id": { + "name": "meal_period_type_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "restaurant_id": { + "name": "restaurant_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "end_time": { + "name": "end_time", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dining_period_meal_period_type_id_date_restaurant_id_index": { + "name": "dining_period_meal_period_type_id_date_restaurant_id_index", + "columns": [ + { + "expression": "meal_period_type_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "restaurant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "dining_period_date_index": { + "name": "dining_period_date_index", + "columns": [ + { + "expression": "date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "dining_period_restaurant_id_index": { + "name": "dining_period_restaurant_id_index", + "columns": [ + { + "expression": "restaurant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dining_period_meal_period_type_id_dining_meal_period_type_adobe_id_fk": { + "name": "dining_period_meal_period_type_id_dining_meal_period_type_adobe_id_fk", + "tableFrom": "dining_period", + "tableTo": "dining_meal_period_type", + "columnsFrom": ["meal_period_type_id"], + "columnsTo": ["adobe_id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "dining_period_restaurant_id_dining_restaurant_id_fk": { + "name": "dining_period_restaurant_id_dining_restaurant_id_fk", + "tableFrom": "dining_period", + "tableTo": "dining_restaurant", + "columnsFrom": ["restaurant_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_restaurant": { + "name": "dining_restaurant", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_schedule": { + "name": "dining_schedule", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "restaurant_id": { + "name": "restaurant_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "upstream_id": { + "name": "upstream_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dining_schedule_restaurant_id_index": { + "name": "dining_schedule_restaurant_id_index", + "columns": [ + { + "expression": "restaurant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dining_schedule_restaurant_id_dining_restaurant_id_fk": { + "name": "dining_schedule_restaurant_id_dining_restaurant_id_fk", + "tableFrom": "dining_schedule", + "tableTo": "dining_restaurant", + "columnsFrom": ["restaurant_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "dining_schedule_restaurant_id_name_start_date_end_date_unique": { + "name": "dining_schedule_restaurant_id_name_start_date_end_date_unique", + "nullsNotDistinct": true, + "columns": ["restaurant_id", "name", "start_date", "end_date"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_schedule_meal_period": { + "name": "dining_schedule_meal_period", + "schema": "", + "columns": { + "schedule_id": { + "name": "schedule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "meal_period_type_id": { + "name": "meal_period_type_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "sun_open": { + "name": "sun_open", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "sun_close": { + "name": "sun_close", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "mon_open": { + "name": "mon_open", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "mon_close": { + "name": "mon_close", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "tue_open": { + "name": "tue_open", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "tue_close": { + "name": "tue_close", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "wed_open": { + "name": "wed_open", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "wed_close": { + "name": "wed_close", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "thu_open": { + "name": "thu_open", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "thu_close": { + "name": "thu_close", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "fri_open": { + "name": "fri_open", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "fri_close": { + "name": "fri_close", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "sat_open": { + "name": "sat_open", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "sat_close": { + "name": "sat_close", + "type": "time", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "dining_schedule_meal_period_schedule_id_dining_schedule_id_fk": { + "name": "dining_schedule_meal_period_schedule_id_dining_schedule_id_fk", + "tableFrom": "dining_schedule_meal_period", + "tableTo": "dining_schedule", + "columnsFrom": ["schedule_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "dining_schedule_meal_period_meal_period_type_id_dining_meal_period_type_adobe_id_fk": { + "name": "dining_schedule_meal_period_meal_period_type_id_dining_meal_period_type_adobe_id_fk", + "tableFrom": "dining_schedule_meal_period", + "tableTo": "dining_meal_period_type", + "columnsFrom": ["meal_period_type_id"], + "columnsTo": ["adobe_id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "dining_schedule_meal_period_pk": { + "name": "dining_schedule_meal_period_pk", + "columns": ["schedule_id", "meal_period_type_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dining_station": { + "name": "dining_station", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "restaurant_id": { + "name": "restaurant_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dining_station_restaurant_id_index": { + "name": "dining_station_restaurant_id_index", + "columns": [ + { + "expression": "restaurant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "dining_station_restaurant_id_dining_restaurant_id_fk": { + "name": "dining_station_restaurant_id_dining_restaurant_id_fk", + "tableFrom": "dining_station", + "tableTo": "dining_restaurant", + "columnsFrom": ["restaurant_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.instructor": { + "name": "instructor", + "schema": "", + "columns": { + "ucinetid": { + "name": "ucinetid", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "department": { + "name": "department", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "instructor_search_index": { + "name": "instructor_search_index", + "columns": [ + { + "expression": "(\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"ucinetid\", '')), 'A') ||\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"name\", '')), 'B') ||\n SETWEIGHT(TO_TSVECTOR('english', COALESCE(\"title\", '')), 'B')\n)", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.instructor_to_websoc_instructor": { + "name": "instructor_to_websoc_instructor", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "instructor_ucinetid": { + "name": "instructor_ucinetid", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "websoc_instructor_name": { + "name": "websoc_instructor_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "instructor_to_websoc_instructor_instructor_ucinetid_index": { + "name": "instructor_to_websoc_instructor_instructor_ucinetid_index", + "columns": [ + { + "expression": "instructor_ucinetid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "instructor_to_websoc_instructor_websoc_instructor_name_index": { + "name": "instructor_to_websoc_instructor_websoc_instructor_name_index", + "columns": [ + { + "expression": "websoc_instructor_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "instructor_to_websoc_instructor_instructor_ucinetid_websoc_instructor_name_index": { + "name": "instructor_to_websoc_instructor_instructor_ucinetid_websoc_instructor_name_index", + "columns": [ + { + "expression": "instructor_ucinetid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "websoc_instructor_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "instructor_to_websoc_instructor_instructor_ucinetid_instructor_ucinetid_fk": { + "name": "instructor_to_websoc_instructor_instructor_ucinetid_instructor_ucinetid_fk", + "tableFrom": "instructor_to_websoc_instructor", + "tableTo": "instructor", + "columnsFrom": ["instructor_ucinetid"], + "columnsTo": ["ucinetid"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "instructor_to_websoc_instructor_websoc_instructor_name_websoc_instructor_name_fk": { + "name": "instructor_to_websoc_instructor_websoc_instructor_name_websoc_instructor_name_fk", + "tableFrom": "instructor_to_websoc_instructor", + "tableTo": "websoc_instructor", + "columnsFrom": ["websoc_instructor_name"], + "columnsTo": ["name"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.larc_section": { + "name": "larc_section", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "course_id": { + "name": "course_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "days_string": { + "name": "days_string", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "time_string": { + "name": "time_string", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "instructor": { + "name": "instructor", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "building": { + "name": "building", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "meets_monday": { + "name": "meets_monday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_tuesday": { + "name": "meets_tuesday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_wednesday": { + "name": "meets_wednesday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_thursday": { + "name": "meets_thursday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_friday": { + "name": "meets_friday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_saturday": { + "name": "meets_saturday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_sunday": { + "name": "meets_sunday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "larc_section_course_id_index": { + "name": "larc_section_course_id_index", + "columns": [ + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "larc_section_course_id_websoc_course_id_fk": { + "name": "larc_section_course_id_websoc_course_id_fk", + "tableFrom": "larc_section", + "tableTo": "websoc_course", + "columnsFrom": ["course_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.library_traffic": { + "name": "library_traffic", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true + }, + "library_name": { + "name": "library_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "location_name": { + "name": "location_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "traffic_count": { + "name": "traffic_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "traffic_percentage": { + "name": "traffic_percentage", + "type": "real", + "primaryKey": false, + "notNull": true + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "library_traffic_library_name_index": { + "name": "library_traffic_library_name_index", + "columns": [ + { + "expression": "library_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "library_traffic_location_name_index": { + "name": "library_traffic_location_name_index", + "columns": [ + { + "expression": "location_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.library_traffic_history": { + "name": "library_traffic_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "location_id": { + "name": "location_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "traffic_count": { + "name": "traffic_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "traffic_percentage": { + "name": "traffic_percentage", + "type": "real", + "primaryKey": false, + "notNull": true + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "library_traffic_history_location_id_timestamp_index": { + "name": "library_traffic_history_location_id_timestamp_index", + "columns": [ + { + "expression": "location_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "timestamp", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "library_traffic_history_timestamp_id_index": { + "name": "library_traffic_history_timestamp_id_index", + "columns": [ + { + "expression": "timestamp", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "library_traffic_history_location_id_library_traffic_id_fk": { + "name": "library_traffic_history_location_id_library_traffic_id_fk", + "tableFrom": "library_traffic_history", + "tableTo": "library_traffic", + "columnsFrom": ["location_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.catalogue_program": { + "name": "catalogue_program", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "program_name": { + "name": "program_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.catalog_program_variation": { + "name": "catalog_program_variation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "program_id": { + "name": "program_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "catalog_program": { + "name": "catalog_program", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "variation_notes": { + "name": "variation_notes", + "type": "varchar[]", + "primaryKey": false, + "notNull": true, + "default": "ARRAY[]::VARCHAR[]" + } + }, + "indexes": {}, + "foreignKeys": { + "catalog_program_variation_program_id_catalogue_program_id_fk": { + "name": "catalog_program_variation_program_id_catalogue_program_id_fk", + "tableFrom": "catalog_program_variation", + "tableTo": "catalogue_program", + "columnsFrom": ["program_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.study_location": { + "name": "study_location", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.study_room": { + "name": "study_room", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "capacity": { + "name": "capacity", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "directions": { + "name": "directions", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "tech_enhanced": { + "name": "tech_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "image_url": { + "name": "image_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "study_location_id": { + "name": "study_location_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "study_room_study_location_id_index": { + "name": "study_room_study_location_id_index", + "columns": [ + { + "expression": "study_location_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "study_room_study_location_id_study_location_id_fk": { + "name": "study_room_study_location_id_study_location_id_fk", + "tableFrom": "study_room", + "tableTo": "study_location", + "columnsFrom": ["study_location_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.study_room_slot": { + "name": "study_room_slot", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "study_room_id": { + "name": "study_room_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "start": { + "name": "start", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "end": { + "name": "end", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "is_available": { + "name": "is_available", + "type": "boolean", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "study_room_slot_study_room_id_index": { + "name": "study_room_slot_study_room_id_index", + "columns": [ + { + "expression": "study_room_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "study_room_slot_study_room_id_start_end_index": { + "name": "study_room_slot_study_room_id_start_end_index", + "columns": [ + { + "expression": "study_room_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "start", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "end", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "study_room_slot_study_room_id_study_room_id_fk": { + "name": "study_room_slot_study_room_id_study_room_id_fk", + "tableFrom": "study_room_slot", + "tableTo": "study_room", + "columnsFrom": ["study_room_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_course": { + "name": "websoc_course", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "department_id": { + "name": "department_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "generated": { + "as": "REPLACE(\"websoc_course\".\"dept_code\", ' ', '') || \"websoc_course\".\"course_number\"", + "type": "stored" + } + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "year": { + "name": "year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "quarter": { + "name": "quarter", + "type": "term", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "school_name": { + "name": "school_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "dept_code": { + "name": "dept_code", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "course_title": { + "name": "course_title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "course_number": { + "name": "course_number", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "course_numeric": { + "name": "course_numeric", + "type": "integer", + "primaryKey": false, + "notNull": true, + "generated": { + "as": "CASE REGEXP_REPLACE(\"websoc_course\".\"course_number\", '\\D', '', 'g') WHEN '' THEN 0 ELSE REGEXP_REPLACE(\"websoc_course\".\"course_number\", '\\D', '', 'g')::INTEGER END", + "type": "stored" + } + }, + "course_comment": { + "name": "course_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "prerequisite_link": { + "name": "prerequisite_link", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "is_ge_1a": { + "name": "is_ge_1a", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_ge_1b": { + "name": "is_ge_1b", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_ge_2": { + "name": "is_ge_2", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_ge_3": { + "name": "is_ge_3", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_ge_4": { + "name": "is_ge_4", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_ge_5a": { + "name": "is_ge_5a", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_ge_5b": { + "name": "is_ge_5b", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_ge_6": { + "name": "is_ge_6", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_ge_7": { + "name": "is_ge_7", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_ge_8": { + "name": "is_ge_8", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "websoc_course_department_id_index": { + "name": "websoc_course_department_id_index", + "columns": [ + { + "expression": "department_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_course_id_index": { + "name": "websoc_course_course_id_index", + "columns": [ + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_school_name_dept_code_course_number_course_title_index": { + "name": "websoc_course_year_quarter_school_name_dept_code_course_number_course_title_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "school_name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "dept_code", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "course_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "course_title", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_1a_index": { + "name": "websoc_course_year_quarter_is_ge_1a_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_1a", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_1b_index": { + "name": "websoc_course_year_quarter_is_ge_1b_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_1b", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_2_index": { + "name": "websoc_course_year_quarter_is_ge_2_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_3_index": { + "name": "websoc_course_year_quarter_is_ge_3_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_4_index": { + "name": "websoc_course_year_quarter_is_ge_4_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_5a_index": { + "name": "websoc_course_year_quarter_is_ge_5a_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_5a", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_5b_index": { + "name": "websoc_course_year_quarter_is_ge_5b_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_5b", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_6_index": { + "name": "websoc_course_year_quarter_is_ge_6_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_6", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_7_index": { + "name": "websoc_course_year_quarter_is_ge_7_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_7", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_is_ge_8_index": { + "name": "websoc_course_year_quarter_is_ge_8_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_ge_8", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_dept_code_index": { + "name": "websoc_course_year_quarter_dept_code_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "dept_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_course_year_quarter_dept_code_course_number_index": { + "name": "websoc_course_year_quarter_dept_code_course_number_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "dept_code", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "course_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "websoc_course_department_id_websoc_department_id_fk": { + "name": "websoc_course_department_id_websoc_department_id_fk", + "tableFrom": "websoc_course", + "tableTo": "websoc_department", + "columnsFrom": ["department_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_department": { + "name": "websoc_department", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "school_id": { + "name": "school_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "year": { + "name": "year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "quarter": { + "name": "quarter", + "type": "term", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "dept_code": { + "name": "dept_code", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "dept_name": { + "name": "dept_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "dept_comment": { + "name": "dept_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "section_code_range_comments": { + "name": "section_code_range_comments", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "course_number_range_comments": { + "name": "course_number_range_comments", + "type": "text[]", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "websoc_department_school_id_index": { + "name": "websoc_department_school_id_index", + "columns": [ + { + "expression": "school_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_department_year_quarter_school_id_dept_code_index": { + "name": "websoc_department_year_quarter_school_id_dept_code_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "school_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "dept_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "websoc_department_school_id_websoc_school_id_fk": { + "name": "websoc_department_school_id_websoc_school_id_fk", + "tableFrom": "websoc_department", + "tableTo": "websoc_school", + "columnsFrom": ["school_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_instructor": { + "name": "websoc_instructor", + "schema": "", + "columns": { + "name": { + "name": "name", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_location": { + "name": "websoc_location", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "building": { + "name": "building", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "room": { + "name": "room", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "websoc_location_building_room_index": { + "name": "websoc_location_building_room_index", + "columns": [ + { + "expression": "building", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "room", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_meta": { + "name": "websoc_meta", + "schema": "", + "columns": { + "name": { + "name": "name", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "last_scraped": { + "name": "last_scraped", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_enrollment_snapshot": { + "name": "last_enrollment_snapshot", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_school": { + "name": "websoc_school", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "year": { + "name": "year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "quarter": { + "name": "quarter", + "type": "term", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "school_name": { + "name": "school_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "school_comment": { + "name": "school_comment", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "websoc_school_year_quarter_school_name_index": { + "name": "websoc_school_year_quarter_school_name_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "school_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_section": { + "name": "websoc_section", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "course_id": { + "name": "course_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "year": { + "name": "year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "quarter": { + "name": "quarter", + "type": "term", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "units": { + "name": "units", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "websoc_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "instructors": { + "name": "instructors", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "meetings": { + "name": "meetings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "final_exam_string": { + "name": "final_exam_string", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "final_exam": { + "name": "final_exam", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "section_num": { + "name": "section_num", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "max_capacity": { + "name": "max_capacity", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "section_code": { + "name": "section_code", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "section_type": { + "name": "section_type", + "type": "websoc_section_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "num_requested": { + "name": "num_requested", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "restriction_string": { + "name": "restriction_string", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "restriction_a": { + "name": "restriction_a", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_b": { + "name": "restriction_b", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_c": { + "name": "restriction_c", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_d": { + "name": "restriction_d", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_e": { + "name": "restriction_e", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_f": { + "name": "restriction_f", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_g": { + "name": "restriction_g", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_h": { + "name": "restriction_h", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_i": { + "name": "restriction_i", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_j": { + "name": "restriction_j", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_k": { + "name": "restriction_k", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_l": { + "name": "restriction_l", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_m": { + "name": "restriction_m", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_n": { + "name": "restriction_n", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_o": { + "name": "restriction_o", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_r": { + "name": "restriction_r", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_s": { + "name": "restriction_s", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restriction_x": { + "name": "restriction_x", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "num_on_waitlist": { + "name": "num_on_waitlist", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "num_waitlist_cap": { + "name": "num_waitlist_cap", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "section_comment": { + "name": "section_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "num_new_only_reserved": { + "name": "num_new_only_reserved", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "num_currently_total_enrolled": { + "name": "num_currently_total_enrolled", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "num_currently_section_enrolled": { + "name": "num_currently_section_enrolled", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_cancelled": { + "name": "is_cancelled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "generated": { + "as": "\"websoc_section\".\"section_comment\" LIKE '%*** CANCELLED ***%' OR \"websoc_section\".\"section_comment\" LIKE '%*** CANCELED ***%'", + "type": "stored" + } + }, + "web_url": { + "name": "web_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "websoc_section_course_id_index": { + "name": "websoc_section_course_id_index", + "columns": [ + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_section_year_quarter_section_code_index": { + "name": "websoc_section_year_quarter_section_code_index", + "columns": [ + { + "expression": "year", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "quarter", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "section_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "websoc_section_course_id_websoc_course_id_fk": { + "name": "websoc_section_course_id_websoc_course_id_fk", + "tableFrom": "websoc_section", + "tableTo": "websoc_course", + "columnsFrom": ["course_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_section_enrollment": { + "name": "websoc_section_enrollment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "section_id": { + "name": "section_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "year": { + "name": "year", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "quarter": { + "name": "quarter", + "type": "term", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "max_capacity": { + "name": "max_capacity", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "num_currently_total_enrolled": { + "name": "num_currently_total_enrolled", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "num_on_waitlist": { + "name": "num_on_waitlist", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "num_waitlist_cap": { + "name": "num_waitlist_cap", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "num_requested": { + "name": "num_requested", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "num_new_only_reserved": { + "name": "num_new_only_reserved", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "websoc_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "websoc_section_enrollment_section_id_index": { + "name": "websoc_section_enrollment_section_id_index", + "columns": [ + { + "expression": "section_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_section_enrollment_section_id_created_at_index": { + "name": "websoc_section_enrollment_section_id_created_at_index", + "columns": [ + { + "expression": "section_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "websoc_section_enrollment_section_id_websoc_section_id_fk": { + "name": "websoc_section_enrollment_section_id_websoc_section_id_fk", + "tableFrom": "websoc_section_enrollment", + "tableTo": "websoc_section", + "columnsFrom": ["section_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_section_grade": { + "name": "websoc_section_grade", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "section_id": { + "name": "section_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "grade_a_count": { + "name": "grade_a_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "grade_b_count": { + "name": "grade_b_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "grade_c_count": { + "name": "grade_c_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "grade_d_count": { + "name": "grade_d_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "grade_f_count": { + "name": "grade_f_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "grade_p_count": { + "name": "grade_p_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "grade_np_count": { + "name": "grade_np_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "grade_w_count": { + "name": "grade_w_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "average_gpa": { + "name": "average_gpa", + "type": "numeric(3, 2)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "websoc_section_grade_section_id_index": { + "name": "websoc_section_grade_section_id_index", + "columns": [ + { + "expression": "section_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "websoc_section_grade_section_id_websoc_section_id_fk": { + "name": "websoc_section_grade_section_id_websoc_section_id_fk", + "tableFrom": "websoc_section_grade", + "tableTo": "websoc_section", + "columnsFrom": ["section_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "websoc_section_grade_section_id_unique": { + "name": "websoc_section_grade_section_id_unique", + "nullsNotDistinct": false, + "columns": ["section_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_section_meeting": { + "name": "websoc_section_meeting", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "section_id": { + "name": "section_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "section_code": { + "name": "section_code", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "meeting_index": { + "name": "meeting_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "time_string": { + "name": "time_string", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "time_is_tba": { + "name": "time_is_tba", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "generated": { + "as": "\"websoc_section_meeting\".\"time_string\" LIKE '%TBA%'", + "type": "stored" + } + }, + "start_time": { + "name": "start_time", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "end_time": { + "name": "end_time", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "days_string": { + "name": "days_string", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "meets_monday": { + "name": "meets_monday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_tuesday": { + "name": "meets_tuesday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_wednesday": { + "name": "meets_wednesday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_thursday": { + "name": "meets_thursday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_friday": { + "name": "meets_friday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_saturday": { + "name": "meets_saturday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "meets_sunday": { + "name": "meets_sunday", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "websoc_section_meeting_section_id_index": { + "name": "websoc_section_meeting_section_id_index", + "columns": [ + { + "expression": "section_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "websoc_section_meeting_section_id_websoc_section_id_fk": { + "name": "websoc_section_meeting_section_id_websoc_section_id_fk", + "tableFrom": "websoc_section_meeting", + "tableTo": "websoc_section", + "columnsFrom": ["section_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_section_meeting_to_location": { + "name": "websoc_section_meeting_to_location", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "meeting_id": { + "name": "meeting_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "location_id": { + "name": "location_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "websoc_section_meeting_to_location_meeting_id_index": { + "name": "websoc_section_meeting_to_location_meeting_id_index", + "columns": [ + { + "expression": "meeting_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_section_meeting_to_location_location_id_index": { + "name": "websoc_section_meeting_to_location_location_id_index", + "columns": [ + { + "expression": "location_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_section_meeting_to_location_meeting_id_location_id_index": { + "name": "websoc_section_meeting_to_location_meeting_id_location_id_index", + "columns": [ + { + "expression": "meeting_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "location_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "websoc_section_meeting_to_location_meeting_id_websoc_section_meeting_id_fk": { + "name": "websoc_section_meeting_to_location_meeting_id_websoc_section_meeting_id_fk", + "tableFrom": "websoc_section_meeting_to_location", + "tableTo": "websoc_section_meeting", + "columnsFrom": ["meeting_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "websoc_section_meeting_to_location_location_id_websoc_location_id_fk": { + "name": "websoc_section_meeting_to_location_location_id_websoc_location_id_fk", + "tableFrom": "websoc_section_meeting_to_location", + "tableTo": "websoc_location", + "columnsFrom": ["location_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.websoc_section_to_instructor": { + "name": "websoc_section_to_instructor", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "section_id": { + "name": "section_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "instructor_name": { + "name": "instructor_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "websoc_section_to_instructor_section_id_index": { + "name": "websoc_section_to_instructor_section_id_index", + "columns": [ + { + "expression": "section_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "websoc_section_to_instructor_instructor_name_index": { + "name": "websoc_section_to_instructor_instructor_name_index", + "columns": [ + { + "expression": "instructor_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "websoc_section_to_instructor_section_id_websoc_section_id_fk": { + "name": "websoc_section_to_instructor_section_id_websoc_section_id_fk", + "tableFrom": "websoc_section_to_instructor", + "tableTo": "websoc_section", + "columnsFrom": ["section_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "websoc_section_to_instructor_instructor_name_websoc_instructor_name_fk": { + "name": "websoc_section_to_instructor_instructor_name_websoc_instructor_name_fk", + "tableFrom": "websoc_section_to_instructor", + "tableTo": "websoc_instructor", + "columnsFrom": ["instructor_name"], + "columnsTo": ["name"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.material_requirement": { + "name": "material_requirement", + "schema": "public", + "values": ["Required", "Recommended", "GoToClassFirst"] + }, + "public.textbook_format": { + "name": "textbook_format", + "schema": "public", + "values": ["Physical", "Electronic", "Both", "OER"] + }, + "public.course_level": { + "name": "course_level", + "schema": "public", + "values": ["LowerDiv", "UpperDiv", "Graduate"] + }, + "public.division": { + "name": "division", + "schema": "public", + "values": ["Undergraduate", "Graduate"] + }, + "public.term": { + "name": "term", + "schema": "public", + "values": ["Fall", "Winter", "Spring", "Summer1", "Summer10wk", "Summer2"] + }, + "public.websoc_section_type": { + "name": "websoc_section_type", + "schema": "public", + "values": [ + "Act", + "Col", + "Dis", + "Fld", + "Lab", + "Lec", + "Qiz", + "Res", + "Sem", + "Stu", + "Tap", + "Tut" + ] + }, + "public.websoc_status": { + "name": "websoc_status", + "schema": "public", + "values": ["OPEN", "Waitl", "FULL", "NewOnly"] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.course_view": { + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "department": { + "name": "department", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "shortened_dept": { + "name": "shortened_dept", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "generated": { + "as": "REPLACE(\"course\".\"department\", ' ', '')", + "type": "stored" + } + }, + "department_alias": { + "name": "department_alias", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "course_number": { + "name": "course_number", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "course_numeric": { + "name": "course_numeric", + "type": "integer", + "primaryKey": false, + "notNull": true, + "generated": { + "as": "CASE REGEXP_REPLACE(\"course\".\"course_number\", '\\D', '', 'g') WHEN '' THEN 0 ELSE REGEXP_REPLACE(\"course\".\"course_number\", '\\D', '', 'g')::INTEGER END", + "type": "stored" + } + }, + "school": { + "name": "school", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "course_level": { + "name": "course_level", + "type": "course_level", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "min_units": { + "name": "min_units", + "type": "numeric(4, 2)", + "primaryKey": false, + "notNull": true + }, + "max_units": { + "name": "max_units", + "type": "numeric(4, 2)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "department_name": { + "name": "department_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "prerequisite_tree": { + "name": "prerequisite_tree", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "prerequisite_text": { + "name": "prerequisite_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "repeatability": { + "name": "repeatability", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "repeatability_times": { + "name": "repeatability_times", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "repeatability_type": { + "name": "repeatability_type", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "grading_option": { + "name": "grading_option", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "concurrent": { + "name": "concurrent", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "same_as": { + "name": "same_as", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "restriction": { + "name": "restriction", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "overlap": { + "name": "overlap", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "corequisites": { + "name": "corequisites", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_ge_1a": { + "name": "is_ge_1a", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_1b": { + "name": "is_ge_1b", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_2": { + "name": "is_ge_2", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_3": { + "name": "is_ge_3", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_4": { + "name": "is_ge_4", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_5a": { + "name": "is_ge_5a", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_5b": { + "name": "is_ge_5b", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_6": { + "name": "is_ge_6", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_7": { + "name": "is_ge_7", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_ge_8": { + "name": "is_ge_8", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "ge_text": { + "name": "ge_text", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"course\".\"id\", \"course\".\"updated_at\", \"course\".\"department\", \"course\".\"shortened_dept\", \"course\".\"department_alias\", \"course\".\"course_number\", \"course\".\"course_numeric\", \"course\".\"school\", \"course\".\"title\", \"course\".\"course_level\", \"course\".\"min_units\", \"course\".\"max_units\", \"course\".\"description\", \"course\".\"department_name\", \"course\".\"prerequisite_tree\", \"course\".\"prerequisite_text\", \"course\".\"repeatability\", \"course\".\"repeatability_times\", \"course\".\"repeatability_type\", \"course\".\"grading_option\", \"course\".\"concurrent\", \"course\".\"same_as\", \"course\".\"restriction\", \"course\".\"overlap\", \"course\".\"corequisites\", \"course\".\"is_ge_1a\", \"course\".\"is_ge_1b\", \"course\".\"is_ge_2\", \"course\".\"is_ge_3\", \"course\".\"is_ge_4\", \"course\".\"is_ge_5a\", \"course\".\"is_ge_5b\", \"course\".\"is_ge_6\", \"course\".\"is_ge_7\", \"course\".\"is_ge_8\", \"course\".\"ge_text\", \n ARRAY_REMOVE(COALESCE(\n (\n SELECT ARRAY_AGG(\n CASE WHEN \"prerequisite_course\".\"id\" IS NULL THEN NULL\n ELSE JSONB_BUILD_OBJECT(\n 'id', \"prerequisite_course\".\"id\",\n 'title', \"prerequisite_course\".\"title\",\n 'department', \"prerequisite_course\".\"department\",\n 'courseNumber', \"prerequisite_course\".\"course_number\"\n )\n END\n )\n FROM \"prerequisite\"\n LEFT JOIN \"course\" \"prerequisite_course\" ON \"prerequisite_course\".\"id\" = \"prerequisite\".\"prerequisite_id\"\n WHERE \"prerequisite\".\"dependency_id\" = \"course\".\"id\"\n ),\n ARRAY[]::JSONB[]), NULL)\n as \"prerequisites\", \n ARRAY_REMOVE(COALESCE(\n (\n SELECT ARRAY_AGG(\n CASE WHEN \"dependency_course\".\"id\" IS NULL THEN NULL\n ELSE JSONB_BUILD_OBJECT(\n 'id', \"dependency_course\".\"id\",\n 'title', \"dependency_course\".\"title\",\n 'department', \"dependency_course\".\"department\",\n 'courseNumber', \"dependency_course\".\"course_number\"\n )\n END\n )\n FROM \"prerequisite\" \"dependency\"\n LEFT JOIN \"course\" \"dependency_course\" ON \"dependency_course\".\"id\" = \"dependency\".\"dependency_id\"\n WHERE \"dependency\".\"prerequisite_id\" = \"course\".\"id\"\n ),\n ARRAY[]::JSONB[]), NULL)\n as \"dependencies\", \n ARRAY_REMOVE(ARRAY_AGG(DISTINCT\n CASE WHEN \"websoc_course\".\"year\" IS NULL THEN NULL\n ELSE CONCAT(\"websoc_course\".\"year\", ' ', \"websoc_course\".\"quarter\")\n END\n ), NULL)\n as \"terms\", \n ARRAY_REMOVE(COALESCE(ARRAY_AGG(DISTINCT\n CASE WHEN \"instructor\".\"ucinetid\" IS NULL THEN NULL\n ELSE JSONB_BUILD_OBJECT(\n 'ucinetid', \"instructor\".\"ucinetid\",\n 'name', \"instructor\".\"name\",\n 'title', \"instructor\".\"title\",\n 'email', \"instructor\".\"email\",\n 'department', \"instructor\".\"department\",\n 'shortenedNames', ARRAY(\n SELECT \"instructor_to_websoc_instructor\".\"websoc_instructor_name\"\n FROM \"instructor_to_websoc_instructor\"\n WHERE \"instructor_to_websoc_instructor\".\"instructor_ucinetid\" = \"instructor\".\"ucinetid\"\n )\n )\n END\n ), ARRAY[]::JSONB[]), NULL)\n as \"instructors\" from \"course\" left join \"websoc_course\" on \"websoc_course\".\"course_id\" = \"course\".\"id\" left join \"websoc_section\" on \"websoc_section\".\"course_id\" = \"websoc_course\".\"id\" left join \"websoc_section_to_instructor\" on \"websoc_section_to_instructor\".\"section_id\" = \"websoc_section\".\"id\" left join \"websoc_instructor\" on \"websoc_instructor\".\"name\" = \"websoc_section_to_instructor\".\"instructor_name\" left join \"instructor_to_websoc_instructor\" on \"instructor_to_websoc_instructor\".\"websoc_instructor_name\" = \"websoc_instructor\".\"name\" left join \"instructor\" on (\"instructor\".\"ucinetid\" = \"instructor_to_websoc_instructor\".\"instructor_ucinetid\" and \"instructor\".\"ucinetid\" is not null and \"instructor\".\"ucinetid\" <> 'student') group by \"course\".\"id\"", + "name": "course_view", + "schema": "public", + "isExisting": false, + "materialized": true + }, + "public.grade_course_summary": { + "columns": { + "dept_code": { + "name": "dept_code", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "course_number": { + "name": "course_number", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"websoc_course\".\"dept_code\", \"websoc_course\".\"course_number\", avg(\"websoc_section_grade\".\"average_gpa\") as \"average_gpa\", sum(\"websoc_section_grade\".\"grade_a_count\") as \"grade_a_count\", sum(\"websoc_section_grade\".\"grade_b_count\") as \"grade_b_count\", sum(\"websoc_section_grade\".\"grade_c_count\") as \"grade_c_count\", sum(\"websoc_section_grade\".\"grade_d_count\") as \"grade_d_count\", sum(\"websoc_section_grade\".\"grade_f_count\") as \"grade_f_count\", sum(\"websoc_section_grade\".\"grade_p_count\") as \"grade_p_count\", sum(\"websoc_section_grade\".\"grade_np_count\") as \"grade_np_count\", sum(\"websoc_section_grade\".\"grade_w_count\") as \"grade_w_count\" from \"websoc_section_grade\" inner join \"websoc_section\" on \"websoc_section\".\"id\" = \"websoc_section_grade\".\"section_id\" inner join \"websoc_course\" on \"websoc_course\".\"id\" = \"websoc_section\".\"course_id\" group by \"websoc_course\".\"dept_code\", \"websoc_course\".\"course_number\"", + "name": "grade_course_summary", + "schema": "public", + "isExisting": false, + "materialized": true + }, + "public.grade_offering_summary": { + "columns": { + "dept_code": { + "name": "dept_code", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "course_number": { + "name": "course_number", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "instructor_name": { + "name": "instructor_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"websoc_course\".\"dept_code\", \"websoc_course\".\"course_number\", \"websoc_section_to_instructor\".\"instructor_name\", avg(\"websoc_section_grade\".\"average_gpa\") as \"average_gpa\", sum(\"websoc_section_grade\".\"grade_a_count\") as \"grade_a_count\", sum(\"websoc_section_grade\".\"grade_b_count\") as \"grade_b_count\", sum(\"websoc_section_grade\".\"grade_c_count\") as \"grade_c_count\", sum(\"websoc_section_grade\".\"grade_d_count\") as \"grade_d_count\", sum(\"websoc_section_grade\".\"grade_f_count\") as \"grade_f_count\", sum(\"websoc_section_grade\".\"grade_p_count\") as \"grade_p_count\", sum(\"websoc_section_grade\".\"grade_np_count\") as \"grade_np_count\", sum(\"websoc_section_grade\".\"grade_w_count\") as \"grade_w_count\" from \"websoc_section_grade\" inner join \"websoc_section\" on \"websoc_section\".\"id\" = \"websoc_section_grade\".\"section_id\" inner join \"websoc_course\" on \"websoc_course\".\"id\" = \"websoc_section\".\"course_id\" inner join \"websoc_section_to_instructor\" on \"websoc_section_to_instructor\".\"section_id\" = \"websoc_section\".\"id\" group by \"websoc_course\".\"dept_code\", \"websoc_course\".\"course_number\", \"websoc_section_to_instructor\".\"instructor_name\"", + "name": "grade_offering_summary", + "schema": "public", + "isExisting": false, + "materialized": true + }, + "public.instructor_view": { + "columns": { + "ucinetid": { + "name": "ucinetid", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "department": { + "name": "department", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "definition": "with \"shortened_names_cte\" as (select \"instructor_ucinetid\", ARRAY_AGG(\"websoc_instructor_name\") as \"shortened_names\" from \"instructor_to_websoc_instructor\" group by \"instructor_to_websoc_instructor\".\"instructor_ucinetid\"), \"courses_cte\" as (with \"terms_cte\" as (select \"course\".\"id\", \"instructor_to_websoc_instructor\".\"instructor_ucinetid\", \n ARRAY_REMOVE(ARRAY_AGG(DISTINCT\n CASE WHEN \"websoc_course\".\"year\" IS NULL THEN NULL\n ELSE CONCAT(\"websoc_course\".\"year\", ' ', \"websoc_course\".\"quarter\")\n END\n ), NULL) as \"terms\" from \"course\" left join \"websoc_course\" on \"websoc_course\".\"course_id\" = \"course\".\"id\" left join \"websoc_section\" on \"websoc_section\".\"course_id\" = \"websoc_course\".\"id\" left join \"websoc_section_to_instructor\" on \"websoc_section_to_instructor\".\"section_id\" = \"websoc_section\".\"id\" left join \"websoc_instructor\" on \"websoc_instructor\".\"name\" = \"websoc_section_to_instructor\".\"instructor_name\" left join \"instructor_to_websoc_instructor\" on \"instructor_to_websoc_instructor\".\"websoc_instructor_name\" = \"websoc_instructor\".\"name\" group by \"course\".\"id\", \"instructor_to_websoc_instructor\".\"instructor_ucinetid\") select \"terms_cte\".\"instructor_ucinetid\", \"course\".\"id\", \n CASE WHEN \"course\".\"id\" IS NULL\n THEN NULL\n ELSE JSONB_BUILD_OBJECT(\n 'id', \"course\".\"id\",\n 'title', \"course\".\"title\",\n 'department', \"course\".\"department\",\n 'courseNumber', \"course\".\"course_number\",\n 'terms', COALESCE(\"terms\", ARRAY[]::TEXT[])\n )\n END\n as \"course_info\" from \"course\" left join \"terms_cte\" on \"terms_cte\".\"id\" = \"course\".\"id\" group by \"course\".\"id\", \"terms_cte\".\"instructor_ucinetid\", \"terms\") select \"instructor\".\"ucinetid\", \"instructor\".\"name\", \"instructor\".\"title\", \"instructor\".\"email\", \"instructor\".\"department\", COALESCE(\"shortened_names\", ARRAY[]::TEXT[]) as \"shortened_names\", \n ARRAY_REMOVE(ARRAY_AGG(DISTINCT \"course_info\"), NULL)\n as \"courses\" from \"instructor\" left join \"shortened_names_cte\" on \"shortened_names_cte\".\"instructor_ucinetid\" = \"instructor\".\"ucinetid\" left join \"courses_cte\" on \"courses_cte\".\"instructor_ucinetid\" = \"instructor\".\"ucinetid\" where \"instructor\".\"ucinetid\" <> 'student' group by \"instructor\".\"ucinetid\", \"shortened_names\"", + "name": "instructor_view", + "schema": "public", + "isExisting": false, + "materialized": true + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index d43148131..c04bded0b 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -295,6 +295,13 @@ "when": 1794201144456, "tag": "0041_dining_dish_to_period_is_first", "breakpoints": true + }, + { + "idx": 42, + "version": "7", + "when": 1794966006806, + "tag": "0042_grade_offering_summary", + "breakpoints": true } ] } diff --git a/packages/db/src/schema/grades.ts b/packages/db/src/schema/grades.ts new file mode 100644 index 000000000..b090c97fd --- /dev/null +++ b/packages/db/src/schema/grades.ts @@ -0,0 +1,54 @@ +import { avg, eq, sum } from "drizzle-orm"; +import { pgMaterializedView } from "drizzle-orm/pg-core"; +import { + websocCourse, + websocSection, + websocSectionGrade, + websocSectionToInstructor, +} from "./websoc.ts"; + +const gradeTotals = { + averageGPA: avg(websocSectionGrade.averageGPA) + .mapWith((value): number | null => Number(value)) + .as("average_gpa"), + gradeACount: sum(websocSectionGrade.gradeACount).mapWith(Number).as("grade_a_count"), + gradeBCount: sum(websocSectionGrade.gradeBCount).mapWith(Number).as("grade_b_count"), + gradeCCount: sum(websocSectionGrade.gradeCCount).mapWith(Number).as("grade_c_count"), + gradeDCount: sum(websocSectionGrade.gradeDCount).mapWith(Number).as("grade_d_count"), + gradeFCount: sum(websocSectionGrade.gradeFCount).mapWith(Number).as("grade_f_count"), + gradePCount: sum(websocSectionGrade.gradePCount).mapWith(Number).as("grade_p_count"), + gradeNPCount: sum(websocSectionGrade.gradeNPCount).mapWith(Number).as("grade_np_count"), + gradeWCount: sum(websocSectionGrade.gradeWCount).mapWith(Number).as("grade_w_count"), +}; + +export const gradeOfferingSummary = pgMaterializedView("grade_offering_summary").as((qb) => + qb + .select({ + deptCode: websocCourse.deptCode, + courseNumber: websocCourse.courseNumber, + instructorName: websocSectionToInstructor.instructorName, + ...gradeTotals, + }) + .from(websocSectionGrade) + .innerJoin(websocSection, eq(websocSection.id, websocSectionGrade.sectionId)) + .innerJoin(websocCourse, eq(websocCourse.id, websocSection.courseId)) + .innerJoin(websocSectionToInstructor, eq(websocSectionToInstructor.sectionId, websocSection.id)) + .groupBy( + websocCourse.deptCode, + websocCourse.courseNumber, + websocSectionToInstructor.instructorName, + ), +); + +export const gradeCourseSummary = pgMaterializedView("grade_course_summary").as((qb) => + qb + .select({ + deptCode: websocCourse.deptCode, + courseNumber: websocCourse.courseNumber, + ...gradeTotals, + }) + .from(websocSectionGrade) + .innerJoin(websocSection, eq(websocSection.id, websocSectionGrade.sectionId)) + .innerJoin(websocCourse, eq(websocCourse.id, websocSection.courseId)) + .groupBy(websocCourse.deptCode, websocCourse.courseNumber), +); diff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.ts index f4416d01f..7ec54651f 100644 --- a/packages/db/src/schema/index.ts +++ b/packages/db/src/schema/index.ts @@ -15,6 +15,7 @@ export * from "./course-materials.ts"; export * from "./courses.ts"; export * from "./degreeworks.ts"; export * from "./dining.ts"; +export * from "./grades.ts"; export * from "./instructors.ts"; export * from "./larc.ts"; export * from "./library-traffic.ts";