aboutsummaryrefslogtreecommitdiff
path: root/drizzle/0006_chunky_meteorite.sql
blob: 471abc5b5041c51a2102c5ef087e454eb099dccc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_routines` (
	`id` integer NOT NULL,
	`version` integer NOT NULL,
	`project_id` integer NOT NULL,
	`name` text NOT NULL,
	`frequency` text NOT NULL,
	`description` text DEFAULT '' NOT NULL,
	`archived` integer DEFAULT false NOT NULL,
	`archived_at` text,
	`created_at` text NOT NULL,
	PRIMARY KEY(`id`, `version`),
	FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
INSERT INTO `__new_routines`("id", "version", "project_id", "name", "frequency", "description", "archived", "archived_at", "created_at") SELECT "id", "version", "project_id", "name", "frequency_days" || 'd', "description", "archived", "archived_at", "created_at" FROM `routines`;--> statement-breakpoint
DROP TABLE `routines`;--> statement-breakpoint
ALTER TABLE `__new_routines` RENAME TO `routines`;--> statement-breakpoint
PRAGMA foreign_keys=ON;