generated from ctc-uci/npo-template-merged
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/ctc-uci/cse into dev
- Loading branch information
Showing
12 changed files
with
125 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE IF NOT EXISTS articles ( | ||
id INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
s3_url VARCHAR(256) NOT NULL, | ||
description TEXT NOT NULL, | ||
media_url VARCHAR(256) NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CREATE TABLE IF NOT EXISTS class_enrollments ( | ||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
student_id INTEGER NOT NULL, | ||
class_id INTEGER NOT NULL, | ||
attendance DATE NOT NULL, | ||
|
||
CONSTRAINT Pk_class_enrollments | ||
PRIMARY KEY(student_id, class_id, id), | ||
|
||
CONSTRAINT fk_student | ||
FOREIGN KEY(student_id) | ||
REFERENCES student(id) | ||
ON DELETE CASCADE, | ||
|
||
CONSTRAINT fk_class | ||
FOREIGN KEY(class_id) | ||
REFERENCES classes(id) | ||
ON DELETE CASCADE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
DROP TABLE IF EXISTS class_videos CASCADE; | ||
|
||
CREATE TABLE class_videos ( | ||
id INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
title VARCHAR(256) NOT NULL, | ||
s3_url VARCHAR(256) NOT NULL, | ||
description TEXT NOT NULL, | ||
media_url TEXT NOT NULL, | ||
class_id INTEGER NOT NULL, | ||
FOREIGN KEY (class_id) REFERENCES classes(id) ON DELETE CASCADE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CREATE TYPE LEVEL AS ENUM ("beginner", "intermediate", "advanced") | ||
|
||
CREATE TABLE IF NOT EXISTS public.classes | ||
( | ||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
title VARCHAR(256) NOT NULL, | ||
description TEXT, | ||
location VARCHAR(256) NOT NULL, | ||
capacity INT NOT NULL, | ||
level LEVEL NOT NULL, | ||
costume TEXT NOT NULL, | ||
CONSTRAINT class_pkey PRIMARY KEY (id), | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CREATE TABLE IF NOT EXISTS classes_taught ( | ||
class_id INTEGER NOT NULL, | ||
teacher_id INTEGER NOT NULL, | ||
|
||
CONSTRAINT Pk_classes_taught | ||
PRIMARY KEY(class_id, teacher_id), | ||
|
||
CONSTRAINT fk_class | ||
FOREIGN KEY(class_id) | ||
REFERENCES classes(id) | ||
ON DELETE CASCADE, | ||
|
||
CONSTRAINT fk_teacher | ||
FOREIGN KEY(teacher_id) | ||
REFERENCES teacher(id) | ||
ON DELETE CASCADE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CREATE TABLE IF NOT EXISTS event_enrollments ( | ||
id INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),, | ||
student_id INTEGER NOT NULL, | ||
event_id INTEGER NOT NULL, | ||
attendance BOOLEAN NOT NULL, | ||
FOREIGN KEY (student_id) REFERENCES students (id) ON DELETE CASCADE, | ||
FOREIGN KEY (event_id) REFERENCES events (id) ON DELETE CASCADE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
DROP TABLE IF EXISTS Events; | ||
DROP TYPE IF EXISTS LEVEL; | ||
|
||
CREATE TYPE LEVEL AS ENUM ('beginner', 'intermediate', 'advanced'); | ||
|
||
CREATE TABLE Events ( | ||
id SERIAL PRIMARY KEY, | ||
location VARCHAR(256) NOT NULL, | ||
title VARCHAR(256) NOT NULL, | ||
description TEXT, | ||
level LEVEL NOT NULL, | ||
date DATE NOT NULL, | ||
start_time TIME NOT NULL, | ||
end_time TIME NOT NULL, | ||
call_time TIME NOT NULL, | ||
class_id INTEGER NOT NULL, | ||
costume TEXT NOT NULL, | ||
FOREIGN KEY (class_id) REFERENCES Classes(id) ON DELETE CASCADE | ||
); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
DROP TABLE IF EXISTS scheduled_classes CASCADE; | ||
|
||
CREATE TABLE scheduled_classes ( | ||
class_id INTEGER NOT NULL, | ||
date DATE NOT NULL, | ||
start_time TIME NOT NULL, | ||
end_time TIME NOT NULL, | ||
PRIMARY KEY (class_id, date), | ||
FOREIGN KEY (class_id) REFERENCES classes(id) ON DELETE CASCADE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CREATE TYPE LEVEL AS ENUM('beginner','intermediate','advanced'); | ||
|
||
|
||
CREATE TABLE Student ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
level LEVEL NOT NULL, | ||
CONSTRAINT fk_user_student FOREIGN KEY (id) REFERENCES User (id) ON DELETE CASCADE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE Teachers ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
experience TEXT, | ||
is_activated BOOL NOT NULL, | ||
CONSTRAINT fk_user_teacher FOREIGN KEY (id) REFERENCES User (id) ON DELETE CASCADE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters