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 "Student_Enrolment" (
"student_enrolment_id" INT,
"semester_id" INT,
PRIMARY KEY ("student_enrolment_id")
);

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

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

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





INSERT INTO "Student_Enrolment" VALUES ("1", "202101");
INSERT INTO "Student_Enrolment" VALUES ("2", "202102");
INSERT INTO "Student_Enrolment" VALUES ("3", "202103");
INSERT INTO "Student_Enrolment" VALUES ("4", "202104");
INSERT INTO "Student_Enrolment" VALUES ("5", "202105");
INSERT INTO "Student_Enrolment_Courses" VALUES ("10", "1001");
INSERT INTO "Student_Enrolment_Courses" VALUES ("11", "1002");
INSERT INTO "Student_Enrolment_Courses" VALUES ("12", "1003");
INSERT INTO "Student_Enrolment_Courses" VALUES ("13", "1004");
INSERT INTO "Student_Enrolment_Courses" VALUES ("14", "1005");
INSERT INTO "Student_Enrolment_Courses" VALUES ("15", "1006");
INSERT INTO "Transcript_Contents" VALUES ("10");
INSERT INTO "Transcript_Contents" VALUES ("11");
INSERT INTO "Transcript_Contents" VALUES ("12");
INSERT INTO "Transcript_Contents" VALUES ("13");
INSERT INTO "Transcript_Contents" VALUES ("14");
INSERT INTO "Transcripts" VALUES ("100", "2023-01-15 09:00:00", "Initial transcript for semester 202101");
INSERT INTO "Transcripts" VALUES ("101", "2023-01-15 09:00:00", "Duplicate date transcript with different details");
INSERT INTO "Transcripts" VALUES ("102", "2023-02-20 14:30:00", "Mid semester transcript");
INSERT INTO "Transcripts" VALUES ("103", "2023-03-10 11:00:00", "Transcript with no contents linked");
INSERT INTO "Transcripts" VALUES ("104", "2023-04-05 16:45:00", "Final transcript for semester 202105");
INSERT INTO "Transcripts" VALUES ("105", "2023-04-05 16:45:00", "Another transcript on same date with different details");
INSERT INTO "Transcripts" VALUES ("106", "2023-05-01 08:00:00", "Transcript with multiple contents linked");
INSERT INTO "Transcripts" VALUES ("107", "2023-06-15 10:15:00", "Transcript with edge case details");
INSERT INTO "Transcripts" VALUES ("108", "2023-07-20 13:00:00", "Transcript with special characters !@#$%^&*");
INSERT INTO "Transcripts" VALUES ("109", "2023-08-25 09:30:00", "Transcript with very long details to test varchar length limitations and ensure system handles large text fields properly without truncation or errors in processing the data");