From 7114ecf54c28f13900a22c43cffc0ecda27c58ba Mon Sep 17 00:00:00 2001 From: Caleb Adepitan Date: Mon, 11 Nov 2024 14:06:44 +0100 Subject: [PATCH] update: generated migrations for schedules et al --- packages/io/drizzle/0001_chemical_zuras.sql | 126 +++ packages/io/drizzle/meta/0001_snapshot.json | 1069 +++++++++++++++++++ packages/io/drizzle/meta/_journal.json | 7 + packages/io/src/migrations/deployment.json | 30 + 4 files changed, 1232 insertions(+) create mode 100644 packages/io/drizzle/0001_chemical_zuras.sql create mode 100644 packages/io/drizzle/meta/0001_snapshot.json diff --git a/packages/io/drizzle/0001_chemical_zuras.sql b/packages/io/drizzle/0001_chemical_zuras.sql new file mode 100644 index 0000000..593490a --- /dev/null +++ b/packages/io/drizzle/0001_chemical_zuras.sql @@ -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`); \ No newline at end of file diff --git a/packages/io/drizzle/meta/0001_snapshot.json b/packages/io/drizzle/meta/0001_snapshot.json new file mode 100644 index 0000000..ca06f5e --- /dev/null +++ b/packages/io/drizzle/meta/0001_snapshot.json @@ -0,0 +1,1069 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "40451eb9-8369-488e-99f7-a45a255bdbfa", + "prevId": "2357a61f-629f-4cd4-b46e-2908bc1191d4", + "tables": { + "custom_frequencies": { + "name": "custom_frequencies", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "schedule_id": { + "name": "schedule_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "generated": { + "as": "(custom)", + "type": "virtual" + } + }, + "crons": { + "name": "crons", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "custom_frequencies_scheduleId_unique": { + "name": "custom_frequencies_scheduleId_unique", + "columns": [ + "schedule_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "custom_frequencies_schedule_id_schedules_id_fk": { + "name": "custom_frequencies_schedule_id_schedules_id_fk", + "tableFrom": "custom_frequencies", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "regular_frequencies": { + "name": "regular_frequencies", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "schedule_id": { + "name": "schedule_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "regular_frequencies_scheduleId_unique": { + "name": "regular_frequencies_scheduleId_unique", + "columns": [ + "schedule_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "regular_frequencies_schedule_id_schedules_id_fk": { + "name": "regular_frequencies_schedule_id_schedules_id_fk", + "tableFrom": "regular_frequencies", + "tableTo": "schedules", + "columnsFrom": [ + "schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "regular_frequency_exprs": { + "name": "regular_frequency_exprs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "regular_frequency_id": { + "name": "regular_frequency_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "every": { + "name": "every", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "regular_frequency_exprs_regularFrequencyId_unique": { + "name": "regular_frequency_exprs_regularFrequencyId_unique", + "columns": [ + "regular_frequency_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "regular_frequency_exprs_regular_frequency_id_regular_frequencies_id_fk": { + "name": "regular_frequency_exprs_regular_frequency_id_regular_frequencies_id_fk", + "tableFrom": "regular_frequency_exprs", + "tableTo": "regular_frequencies", + "columnsFrom": [ + "regular_frequency_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "regular_frequency_monthly_days_subexprs": { + "name": "regular_frequency_monthly_days_subexprs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "regular_frequency_monthly_subexpr_id": { + "name": "regular_frequency_monthly_subexpr_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "days": { + "name": "days", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "regular_frequency_monthly_days_subexprs_regularFrequencyMonthlySubexprId_unique": { + "name": "regular_frequency_monthly_days_subexprs_regularFrequencyMonthlySubexprId_unique", + "columns": [ + "regular_frequency_monthly_subexpr_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "regular_frequency_monthly_days_subexprs_regular_frequency_monthly_subexpr_id_regular_frequency_monthly_subexprs_id_fk": { + "name": "regular_frequency_monthly_days_subexprs_regular_frequency_monthly_subexpr_id_regular_frequency_monthly_subexprs_id_fk", + "tableFrom": "regular_frequency_monthly_days_subexprs", + "tableTo": "regular_frequency_monthly_subexprs", + "columnsFrom": [ + "regular_frequency_monthly_subexpr_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "regular_frequency_monthly_ordinal_subexprs": { + "name": "regular_frequency_monthly_ordinal_subexprs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "regular_frequency_monthly_subexpr_id": { + "name": "regular_frequency_monthly_subexpr_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "weekday": { + "name": "weekday", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ordinal": { + "name": "ordinal", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "regular_frequency_monthly_ordinal_subexprs_regularFrequencyMonthlySubexprId_unique": { + "name": "regular_frequency_monthly_ordinal_subexprs_regularFrequencyMonthlySubexprId_unique", + "columns": [ + "regular_frequency_monthly_subexpr_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "regular_frequency_monthly_ordinal_subexprs_regular_frequency_monthly_subexpr_id_regular_frequency_monthly_subexprs_id_fk": { + "name": "regular_frequency_monthly_ordinal_subexprs_regular_frequency_monthly_subexpr_id_regular_frequency_monthly_subexprs_id_fk", + "tableFrom": "regular_frequency_monthly_ordinal_subexprs", + "tableTo": "regular_frequency_monthly_subexprs", + "columnsFrom": [ + "regular_frequency_monthly_subexpr_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "regular_frequency_monthly_subexprs": { + "name": "regular_frequency_monthly_subexprs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "regular_frequency_subexpr_id": { + "name": "regular_frequency_subexpr_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "regular_frequency_monthly_subexprs_regularFrequencySubexprId_unique": { + "name": "regular_frequency_monthly_subexprs_regularFrequencySubexprId_unique", + "columns": [ + "regular_frequency_subexpr_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "regular_frequency_monthly_subexprs_regular_frequency_subexpr_id_regular_frequency_subexprs_id_fk": { + "name": "regular_frequency_monthly_subexprs_regular_frequency_subexpr_id_regular_frequency_subexprs_id_fk", + "tableFrom": "regular_frequency_monthly_subexprs", + "tableTo": "regular_frequency_subexprs", + "columnsFrom": [ + "regular_frequency_subexpr_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "regular_frequency_subexprs": { + "name": "regular_frequency_subexprs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "regular_frequency_expr_id": { + "name": "regular_frequency_expr_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "regular_frequency_subexprs_regularFrequencyExprId_unique": { + "name": "regular_frequency_subexprs_regularFrequencyExprId_unique", + "columns": [ + "regular_frequency_expr_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "regular_frequency_subexprs_regular_frequency_expr_id_regular_frequencies_id_fk": { + "name": "regular_frequency_subexprs_regular_frequency_expr_id_regular_frequencies_id_fk", + "tableFrom": "regular_frequency_subexprs", + "tableTo": "regular_frequencies", + "columnsFrom": [ + "regular_frequency_expr_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "regular_frequency_weekly_subexprs": { + "name": "regular_frequency_weekly_subexprs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "regular_frequency_subexpr_id": { + "name": "regular_frequency_subexpr_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "weekdays": { + "name": "weekdays", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "regular_frequency_weekly_subexprs_regularFrequencySubexprId_unique": { + "name": "regular_frequency_weekly_subexprs_regularFrequencySubexprId_unique", + "columns": [ + "regular_frequency_subexpr_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "regular_frequency_weekly_subexprs_regular_frequency_subexpr_id_regular_frequency_subexprs_id_fk": { + "name": "regular_frequency_weekly_subexprs_regular_frequency_subexpr_id_regular_frequency_subexprs_id_fk", + "tableFrom": "regular_frequency_weekly_subexprs", + "tableTo": "regular_frequency_subexprs", + "columnsFrom": [ + "regular_frequency_subexpr_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "regular_frequency_yearly_in_subexprs": { + "name": "regular_frequency_yearly_in_subexprs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "regular_frequency_subexpr_id": { + "name": "regular_frequency_subexpr_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "months": { + "name": "months", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "regular_frequency_yearly_in_subexprs_regularFrequencySubexprId_unique": { + "name": "regular_frequency_yearly_in_subexprs_regularFrequencySubexprId_unique", + "columns": [ + "regular_frequency_subexpr_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "regular_frequency_yearly_in_subexprs_regular_frequency_subexpr_id_regular_frequency_subexprs_id_fk": { + "name": "regular_frequency_yearly_in_subexprs_regular_frequency_subexpr_id_regular_frequency_subexprs_id_fk", + "tableFrom": "regular_frequency_yearly_in_subexprs", + "tableTo": "regular_frequency_subexprs", + "columnsFrom": [ + "regular_frequency_subexpr_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "regular_frequency_yearly_on_subexprs": { + "name": "regular_frequency_yearly_on_subexprs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "regular_frequency_subexpr_id": { + "name": "regular_frequency_subexpr_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "variable_weekday": { + "name": "variable_weekday", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "constant_weekday": { + "name": "constant_weekday", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ordinal": { + "name": "ordinal", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "regular_frequency_yearly_on_subexprs_regularFrequencySubexprId_unique": { + "name": "regular_frequency_yearly_on_subexprs_regularFrequencySubexprId_unique", + "columns": [ + "regular_frequency_subexpr_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "regular_frequency_yearly_on_subexprs_regular_frequency_subexpr_id_regular_frequency_subexprs_id_fk": { + "name": "regular_frequency_yearly_on_subexprs_regular_frequency_subexpr_id_regular_frequency_subexprs_id_fk", + "tableFrom": "regular_frequency_yearly_on_subexprs", + "tableTo": "regular_frequency_subexprs", + "columnsFrom": [ + "regular_frequency_subexpr_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "schedules": { + "name": "schedules", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "task_id": { + "name": "task_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "anchor_timestamp": { + "name": "anchor_timestamp", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "timestamp": { + "name": "timestamp", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "frequency_type": { + "name": "frequency_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "schedules_taskId_unique": { + "name": "schedules_taskId_unique", + "columns": [ + "task_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "schedules_task_id_tasks_id_fk": { + "name": "schedules_task_id_tasks_id_fk", + "tableFrom": "schedules", + "tableTo": "tasks", + "columnsFrom": [ + "task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tags_to_tasks": { + "name": "tags_to_tasks", + "columns": { + "tag_id": { + "name": "tag_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "task_id": { + "name": "task_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "tags_to_tasks_tag_id_tags_id_fk": { + "name": "tags_to_tasks_tag_id_tags_id_fk", + "tableFrom": "tags_to_tasks", + "tableTo": "tags", + "columnsFrom": [ + "tag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_to_tasks_task_id_tasks_id_fk": { + "name": "tags_to_tasks_task_id_tasks_id_fk", + "tableFrom": "tags_to_tasks", + "tableTo": "tasks", + "columnsFrom": [ + "task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tags_to_tasks_tag_id_task_id_pk": { + "columns": [ + "tag_id", + "task_id" + ], + "name": "tags_to_tasks_tag_id_task_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tags": { + "name": "tags", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tasks": { + "name": "tasks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%s', 'now') || substr(strftime('%f', 'now'), -3))" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "tasks_title_idx": { + "name": "tasks_title_idx", + "columns": [ + "title" + ], + "isUnique": false + }, + "tasks_summary_idx": { + "name": "tasks_summary_idx", + "columns": [ + "summary" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/packages/io/drizzle/meta/_journal.json b/packages/io/drizzle/meta/_journal.json index b211a67..cc0bbb3 100644 --- a/packages/io/drizzle/meta/_journal.json +++ b/packages/io/drizzle/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1730843246327, "tag": "0000_jittery_mantis", "breakpoints": true + }, + { + "idx": 1, + "version": "6", + "when": 1731323500543, + "tag": "0001_chemical_zuras", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/io/src/migrations/deployment.json b/packages/io/src/migrations/deployment.json index 40d1e97..a4b0118 100644 --- a/packages/io/src/migrations/deployment.json +++ b/packages/io/src/migrations/deployment.json @@ -11,5 +11,35 @@ "CREATE INDEX `tasks_title_idx` ON `tasks` (`title`);", "CREATE INDEX `tasks_summary_idx` ON `tasks` (`summary`);" ] + }, + { + "idx": 1, + "when": 1731323500543, + "tag": "0001_chemical_zuras", + "hash": "447369c5b8e4f2ef0864a738b592a9f0c4edfbb2b1de4848d280f6dfdb5bdc2e", + "sql": [ + "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);", + "CREATE UNIQUE INDEX `custom_frequencies_scheduleId_unique` ON `custom_frequencies` (`schedule_id`);", + "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);", + "CREATE UNIQUE INDEX `regular_frequencies_scheduleId_unique` ON `regular_frequencies` (`schedule_id`);", + "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);", + "CREATE UNIQUE INDEX `regular_frequency_exprs_regularFrequencyId_unique` ON `regular_frequency_exprs` (`regular_frequency_id`);", + "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);", + "CREATE UNIQUE INDEX `regular_frequency_monthly_days_subexprs_regularFrequencyMonthlySubexprId_unique` ON `regular_frequency_monthly_days_subexprs` (`regular_frequency_monthly_subexpr_id`);", + "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);", + "CREATE UNIQUE INDEX `regular_frequency_monthly_ordinal_subexprs_regularFrequencyMonthlySubexprId_unique` ON `regular_frequency_monthly_ordinal_subexprs` (`regular_frequency_monthly_subexpr_id`);", + "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);", + "CREATE UNIQUE INDEX `regular_frequency_monthly_subexprs_regularFrequencySubexprId_unique` ON `regular_frequency_monthly_subexprs` (`regular_frequency_subexpr_id`);", + "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);", + "CREATE UNIQUE INDEX `regular_frequency_subexprs_regularFrequencyExprId_unique` ON `regular_frequency_subexprs` (`regular_frequency_expr_id`);", + "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);", + "CREATE UNIQUE INDEX `regular_frequency_weekly_subexprs_regularFrequencySubexprId_unique` ON `regular_frequency_weekly_subexprs` (`regular_frequency_subexpr_id`);", + "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);", + "CREATE UNIQUE INDEX `regular_frequency_yearly_in_subexprs_regularFrequencySubexprId_unique` ON `regular_frequency_yearly_in_subexprs` (`regular_frequency_subexpr_id`);", + "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);", + "CREATE UNIQUE INDEX `regular_frequency_yearly_on_subexprs_regularFrequencySubexprId_unique` ON `regular_frequency_yearly_on_subexprs` (`regular_frequency_subexpr_id`);", + "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);", + "CREATE UNIQUE INDEX `schedules_taskId_unique` ON `schedules` (`task_id`);" + ] } ] \ No newline at end of file