homeio
PublikFork dari doctor-io/homeio
0002_notifications_scheduled_tasks.sql
CREATE TABLE IF NOT EXISTS "notifications" (
"id" text PRIMARY KEY NOT NULL,
"title" text NOT NULL,
"body" text NOT NULL,
"kind" text DEFAULT 'info' NOT NULL,
"read" boolean DEFAULT false NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "scheduled_tasks" (
"id" text PRIMARY KEY NOT NULL,
"label" text NOT NULL,
"task_type" text NOT NULL,
"task_config" jsonb DEFAULT '{}'::jsonb NOT NULL,
"cron_expression" text NOT NULL,
"enabled" boolean DEFAULT true NOT NULL,
"last_run_at" timestamp with time zone,
"last_run_status" text,
"last_run_output" text,
"next_run_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "notifications_created_at_idx" ON "notifications" USING btree ("created_at" DESC NULLS LAST);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "scheduled_tasks_next_run_at_idx" ON "scheduled_tasks" USING btree ("next_run_at");
--> statement-breakpoint
DROP TABLE IF EXISTS "instance_config";