PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "Courses" (
"course_id" INT,
"course_name" VARCHAR(255),
PRIMARY KEY ("course_id")
);

CREATE TABLE "Student_Enrolment" (
"student_enrolment_id" INT,
"degree_program_id" INT,
"semester_id" INT,
PRIMARY KEY ("student_enrolment_id")
);

CREATE TABLE "Student_Enrolment_Courses" (
"student_course_id" INT UNIQUE,
PRIMARY KEY ("student_course_id")
);

CREATE TABLE "Transcript_Contents" (
"student_course_id" INT,
"transcript_id" INT,
FOREIGN KEY ("transcript_id") REFERENCES "Transcripts"("transcript_id"),
FOREIGN KEY ("student_course_id") REFERENCES "Student_Enrolment_Courses"("student_course_id")
);

CREATE TABLE "Transcripts" (
"transcript_id" INT UNIQUE,
"transcript_date" DATETIME,
PRIMARY KEY ("transcript_id")
);





INSERT INTO "Courses" VALUES ("1", "Mathematics");
INSERT INTO "Courses" VALUES ("2", "History");
INSERT INTO "Courses" VALUES ("3", "Biology");
INSERT INTO "Courses" VALUES ("4", "Computer Science");
INSERT INTO "Courses" VALUES ("5", "Philosophy");
INSERT INTO "Student_Enrolment" VALUES ("101", "10", "1");
INSERT INTO "Student_Enrolment" VALUES ("102", "10", "2");
INSERT INTO "Student_Enrolment" VALUES ("103", "11", "1");
INSERT INTO "Student_Enrolment" VALUES ("104", "12", "3");
INSERT INTO "Student_Enrolment" VALUES ("105", "12", "2");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1001");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1002");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1003");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1004");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1005");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1006");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1007");
INSERT INTO "Transcripts" VALUES ("201", "2022-01-15 10:00:00");
INSERT INTO "Transcripts" VALUES ("202", "2022-06-30 15:30:00");
INSERT INTO "Transcripts" VALUES ("203", "2023-03-10 09:45:00");
INSERT INTO "Transcripts" VALUES ("204", "NULL");
INSERT INTO "Transcripts" VALUES ("205", "2021-12-01 12:00:00");
INSERT INTO "Transcripts" VALUES ("206", "2023-11-20 08:00:00");
INSERT INTO "Transcripts" VALUES ("207", "2020-05-05 14:20:00");
INSERT INTO "Transcript_Contents" VALUES ("1001", "201");
INSERT INTO "Transcript_Contents" VALUES ("1002", "202");
INSERT INTO "Transcript_Contents" VALUES ("1003", "203");
INSERT INTO "Transcript_Contents" VALUES ("1004", "204");
INSERT INTO "Transcript_Contents" VALUES ("1005", "205");
INSERT INTO "Transcript_Contents" VALUES ("1006", "206");
INSERT INTO "Transcript_Contents" VALUES ("1007", "207");