diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-08-29 06:32:29 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-08-29 06:32:29 -0400 |
commit | 1907c3b9e2223005697fca88abc051c72d67531d (patch) | |
tree | 699fba3f1296c2221c97fe1fdfb6548dbdabddb1 /data_model/schema.sql | |
parent | b32d06e251dd528ddde00e78792f3e0e0e0bcfb3 (diff) | |
download | Planner-master.tar.gz Planner-master.zip |
Diffstat (limited to 'data_model/schema.sql')
-rw-r--r-- | data_model/schema.sql | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/data_model/schema.sql b/data_model/schema.sql new file mode 100644 index 0000000..c4a554d --- /dev/null +++ b/data_model/schema.sql @@ -0,0 +1,54 @@ +BEGIN TRANSACTION; +DROP TABLE IF EXISTS "Schedules"; +CREATE TABLE IF NOT EXISTS "Schedules" ( + "id" INTEGER, + "name" TEXT NOT NULL, + PRIMARY KEY("id") +); +DROP TABLE IF EXISTS "Tasks"; +CREATE TABLE IF NOT EXISTS "Tasks" ( + "id" INTEGER, + "name" TEXT NOT NULL, + "description" TEXT, + "frequency" INTEGER NOT NULL, + "estimated_length" INTEGER, + "date_completed" INTEGER, + PRIMARY KEY("id") +); +DROP TABLE IF EXISTS "TimeSlotTasks"; +CREATE TABLE IF NOT EXISTS "TimeSlotTasks" ( + "timeslot_id" INTEGER NOT NULL, + "task_id" INTEGER NOT NULL, + PRIMARY KEY("timeslot_id","task_id"), + FOREIGN KEY("task_id") REFERENCES "Tasks"("id") ON UPDATE CASCADE ON DELETE CASCADE, + FOREIGN KEY("timeslot_id") REFERENCES "TimeSlots"("id") ON UPDATE CASCADE ON DELETE CASCADE +); +DROP TABLE IF EXISTS "SubTasks"; +CREATE TABLE IF NOT EXISTS "SubTasks" ( + "id" INTEGER, + "task_id" INTEGER NOT NULL, + "name" TEXT NOT NULL, + "date_completed" INTEGER, + PRIMARY KEY("id"), + FOREIGN KEY("task_id") REFERENCES "Tasks"("id") ON UPDATE CASCADE ON DELETE CASCADE +); +DROP TABLE IF EXISTS "TimeSlots"; +CREATE TABLE IF NOT EXISTS "TimeSlots" ( + "id" INTEGER, + "schedule_id" INTEGER NOT NULL, + "start_time" INTEGER NOT NULL, + "end_time" INTEGER NOT NULL, + "name" TEXT NOT NULL, + "date_completed" INTEGER, + PRIMARY KEY("id"), + FOREIGN KEY("schedule_id") REFERENCES "Schedules"("id") ON UPDATE CASCADE ON DELETE CASCADE +); +DROP TABLE IF EXISTS "Version"; +CREATE TABLE IF NOT EXISTS "Version" ( + "major" INTEGER NOT NULL, + "minor" INTEGER NOT NULL, + "patch" INTEGER NOT NULL +); +INSERT INTO "Schedules" VALUES (1,'default'); +INSERT INTO "Version" VALUES (0,1,0); +COMMIT; |