-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: generated migrations for schedules et al
- Loading branch information
1 parent
91e5cf6
commit 7114ecf
Showing
4 changed files
with
1,232 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
CREATE TABLE `custom_frequencies` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`schedule_id` text NOT NULL, | ||
`type` text GENERATED ALWAYS AS (custom) VIRTUAL NOT NULL, | ||
`crons` text NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`schedule_id`) REFERENCES `schedules`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `custom_frequencies_scheduleId_unique` ON `custom_frequencies` (`schedule_id`);--> statement-breakpoint | ||
CREATE TABLE `regular_frequencies` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`schedule_id` text NOT NULL, | ||
`type` text NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`schedule_id`) REFERENCES `schedules`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `regular_frequencies_scheduleId_unique` ON `regular_frequencies` (`schedule_id`);--> statement-breakpoint | ||
CREATE TABLE `regular_frequency_exprs` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`regular_frequency_id` text NOT NULL, | ||
`every` integer NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`regular_frequency_id`) REFERENCES `regular_frequencies`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `regular_frequency_exprs_regularFrequencyId_unique` ON `regular_frequency_exprs` (`regular_frequency_id`);--> statement-breakpoint | ||
CREATE TABLE `regular_frequency_monthly_days_subexprs` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`regular_frequency_monthly_subexpr_id` text NOT NULL, | ||
`days` integer NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`regular_frequency_monthly_subexpr_id`) REFERENCES `regular_frequency_monthly_subexprs`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `regular_frequency_monthly_days_subexprs_regularFrequencyMonthlySubexprId_unique` ON `regular_frequency_monthly_days_subexprs` (`regular_frequency_monthly_subexpr_id`);--> statement-breakpoint | ||
CREATE TABLE `regular_frequency_monthly_ordinal_subexprs` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`regular_frequency_monthly_subexpr_id` text NOT NULL, | ||
`weekday` integer NOT NULL, | ||
`ordinal` text NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`regular_frequency_monthly_subexpr_id`) REFERENCES `regular_frequency_monthly_subexprs`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `regular_frequency_monthly_ordinal_subexprs_regularFrequencyMonthlySubexprId_unique` ON `regular_frequency_monthly_ordinal_subexprs` (`regular_frequency_monthly_subexpr_id`);--> statement-breakpoint | ||
CREATE TABLE `regular_frequency_monthly_subexprs` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`regular_frequency_subexpr_id` text NOT NULL, | ||
`type` text NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`regular_frequency_subexpr_id`) REFERENCES `regular_frequency_subexprs`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `regular_frequency_monthly_subexprs_regularFrequencySubexprId_unique` ON `regular_frequency_monthly_subexprs` (`regular_frequency_subexpr_id`);--> statement-breakpoint | ||
CREATE TABLE `regular_frequency_subexprs` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`regular_frequency_expr_id` text NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`regular_frequency_expr_id`) REFERENCES `regular_frequencies`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `regular_frequency_subexprs_regularFrequencyExprId_unique` ON `regular_frequency_subexprs` (`regular_frequency_expr_id`);--> statement-breakpoint | ||
CREATE TABLE `regular_frequency_weekly_subexprs` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`regular_frequency_subexpr_id` text NOT NULL, | ||
`weekdays` integer NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`regular_frequency_subexpr_id`) REFERENCES `regular_frequency_subexprs`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `regular_frequency_weekly_subexprs_regularFrequencySubexprId_unique` ON `regular_frequency_weekly_subexprs` (`regular_frequency_subexpr_id`);--> statement-breakpoint | ||
CREATE TABLE `regular_frequency_yearly_in_subexprs` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`regular_frequency_subexpr_id` text NOT NULL, | ||
`months` integer NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`regular_frequency_subexpr_id`) REFERENCES `regular_frequency_subexprs`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `regular_frequency_yearly_in_subexprs_regularFrequencySubexprId_unique` ON `regular_frequency_yearly_in_subexprs` (`regular_frequency_subexpr_id`);--> statement-breakpoint | ||
CREATE TABLE `regular_frequency_yearly_on_subexprs` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`regular_frequency_subexpr_id` text NOT NULL, | ||
`variable_weekday` text, | ||
`constant_weekday` integer, | ||
`ordinal` text NOT NULL, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`regular_frequency_subexpr_id`) REFERENCES `regular_frequency_subexprs`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `regular_frequency_yearly_on_subexprs_regularFrequencySubexprId_unique` ON `regular_frequency_yearly_on_subexprs` (`regular_frequency_subexpr_id`);--> statement-breakpoint | ||
CREATE TABLE `schedules` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`task_id` text NOT NULL, | ||
`anchor_timestamp` integer NOT NULL, | ||
`timestamp` integer NOT NULL, | ||
`frequency_type` text, | ||
`created_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`updated_at` integer DEFAULT (strftime('%s', 'now') || substr(strftime('%f', 'now'), -3)) NOT NULL, | ||
`deleted_at` integer, | ||
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE cascade | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `schedules_taskId_unique` ON `schedules` (`task_id`); |
Oops, something went wrong.