Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
3.2 kB ยท 81 lines
SQL
at incident-api
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081CREATE TABLE `incident` ( `id` integer PRIMARY KEY NOT NULL, `status` text(2) NOT NULL, `page_id` text NOT NULL, `updated_at` integer DEFAULT (strftime('%s', 'now')), FOREIGN KEY (`page_id`) REFERENCES `page`(`id`) ON UPDATE no action ON DELETE cascade);--> statement-breakpointCREATE TABLE `incident_update` ( `id` integer PRIMARY KEY NOT NULL, `uuid` text NOT NULL, `incident_date` integer, `title` text(256), `message` text, `incident_id` integer NOT NULL, `updated_at` integer DEFAULT (strftime('%s', 'now')), FOREIGN KEY (`incident_id`) REFERENCES `incident`(`id`) ON UPDATE no action ON DELETE cascade);--> statement-breakpointCREATE TABLE `page` ( `id` integer PRIMARY KEY NOT NULL, `workspace_id` integer NOT NULL, `title` text NOT NULL, `description` text NOT NULL, `icon` text(256), `slug` text(256) NOT NULL, `custom_domain` text(256) NOT NULL, `published` integer DEFAULT false, `updated_at` integer DEFAULT (strftime('%s', 'now')), FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE cascade);--> statement-breakpointCREATE TABLE `monitor` ( `id` integer PRIMARY KEY NOT NULL, `job_type` text(3) DEFAULT 'other' NOT NULL, `periodicity` text(6) DEFAULT 'other' NOT NULL, `status` text(2) DEFAULT 'inactive' NOT NULL, `active` integer DEFAULT false, `url` text(512) NOT NULL, `name` text(256) DEFAULT '' NOT NULL, `description` text DEFAULT '' NOT NULL, `workspace_id` integer, `updated_at` integer DEFAULT (strftime('%s', 'now')), FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE no action);--> statement-breakpointCREATE TABLE `monitors_to_pages` ( `monitor_id` integer NOT NULL, `page_id` integer NOT NULL, PRIMARY KEY(`monitor_id`, `page_id`), FOREIGN KEY (`monitor_id`) REFERENCES `monitor`(`id`) ON UPDATE no action ON DELETE cascade, FOREIGN KEY (`page_id`) REFERENCES `page`(`id`) ON UPDATE no action ON DELETE cascade);--> statement-breakpointCREATE TABLE `user` ( `id` integer PRIMARY KEY NOT NULL, `tenant_id` text(256), `updated_at` integer DEFAULT (strftime('%s', 'now')));--> statement-breakpointCREATE TABLE `users_to_workspaces` ( `user_id` integer NOT NULL, `workspace_id` integer NOT NULL, PRIMARY KEY(`user_id`, `workspace_id`), FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE no action);--> statement-breakpointCREATE TABLE `workspace` ( `id` integer PRIMARY KEY NOT NULL, `slug` text NOT NULL, `stripe_id` text(256), `name` text, `updated_at` integer DEFAULT (strftime('%s', 'now')));--> statement-breakpointCREATE UNIQUE INDEX `incident_update_uuid_unique` ON `incident_update` (`uuid`);--> statement-breakpointCREATE UNIQUE INDEX `page_slug_unique` ON `page` (`slug`);--> statement-breakpointCREATE UNIQUE INDEX `user_tenant_id_unique` ON `user` (`tenant_id`);--> statement-breakpointCREATE UNIQUE INDEX `workspace_slug_unique` ON `workspace` (`slug`);--> statement-breakpointCREATE UNIQUE INDEX `workspace_stripe_id_unique` ON `workspace` (`stripe_id`);