diff options
Diffstat (limited to 'drizzle/0003_mixed_captain_midlands.sql')
| -rw-r--r-- | drizzle/0003_mixed_captain_midlands.sql | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drizzle/0003_mixed_captain_midlands.sql b/drizzle/0003_mixed_captain_midlands.sql new file mode 100644 index 0000000..af499d3 --- /dev/null +++ b/drizzle/0003_mixed_captain_midlands.sql @@ -0,0 +1,27 @@ +CREATE TABLE `projects` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `name` text NOT NULL, + `archived` integer DEFAULT false NOT NULL +); +--> statement-breakpoint +CREATE UNIQUE INDEX `projects_name_unique` ON `projects` (`name`);--> statement-breakpoint +CREATE TABLE `routine_completions` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `routine_id` integer NOT NULL, + `routine_version` integer NOT NULL, + `done_at` text NOT NULL, + `note` text, + FOREIGN KEY (`routine_id`,`routine_version`) REFERENCES `routines`(`id`,`version`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE TABLE `routines` ( + `id` integer NOT NULL, + `version` integer NOT NULL, + `project_id` integer NOT NULL, + `name` text NOT NULL, + `frequency_days` integer NOT NULL, + `archived` integer DEFAULT false NOT NULL, + `created_at` text NOT NULL, + PRIMARY KEY(`id`, `version`), + FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade +); |
