···11import Link from "next/link";
22import type * as z from "zod";
3344-import type { insertMonitorSchema } from "@openstatus/db/src/schema";
44+import type {
55+ allMonitorsSchema,
66+ insertMonitorSchema,
77+} from "@openstatus/db/src/schema";
5869import { EmptyState as DefaultEmptyState } from "@/components/dashboard/empty-state";
710import { Button } from "@/components/ui/button";
811import { CreateForm } from "./create-form";
9121010-type MonitorSchema = z.infer<typeof insertMonitorSchema>;
1111-1213export function EmptyState({
1314 workspaceId,
1415 allMonitors,
1516}: {
1617 workspaceId: number;
1717- allMonitors?: MonitorSchema[];
1818+ allMonitors?: z.infer<typeof allMonitorsSchema>;
1819}) {
1920 // Navigate user to monitor if they don't have one
2021 if (!Boolean(allMonitors?.length)) {
···11+DROP INDEX IF EXISTS page_custom_domain_unique;--> statement-breakpoint
22+/*
33+ SQLite does not support "Drop default from column" out of the box, we do not generate automatic migration for that, so it has to be done manually
44+ Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
55+ https://www.sqlite.org/lang_altertable.html
66+ https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3
77+88+ Due to that we don't generate migration automatically and it has to be done manually
99+*/
1010+1111+ALTER TABLE `page` RENAME TO `page_old`;
1212+--> statement-breakpoint
1313+1414+CREATE TABLE `page` (
1515+ id integer PRIMARY KEY NOT NULL,
1616+ workspace_id integer NOT NULL,
1717+ title text NOT NULL,
1818+ description text NOT NULL,
1919+ icon text(256),
2020+ slug text(256) NOT NULL,
2121+ custom_domain text(256),
2222+ updated_at integer DEFAULT (strftime('%s', 'now')),
2323+ FOREIGN KEY (workspace_id) REFERENCES workspace(id) ON UPDATE no action ON DELETE no action
2424+);
2525+--> statement-breakpoint
2626+2727+INSERT INTO `page` SELECT * FROM `page_old`;
2828+2929+--> statement-breakpoint
3030+DROP TABLE `page_old`;
3131+
···11+CREATE TABLE `monitors_to_pages` (
22+ `monitor_id` integer NOT NULL,
33+ `page_id` integer NOT NULL,
44+ PRIMARY KEY(`monitor_id`, `page_id`),
55+ FOREIGN KEY (`monitor_id`) REFERENCES `monitor`(`id`) ON UPDATE no action ON DELETE no action,
66+ FOREIGN KEY (`page_id`) REFERENCES `page`(`id`) ON UPDATE no action ON DELETE no action
77+);
+49
packages/db/drizzle/0003_windy_lionheart.sql
···11+/*
22+ SQLite does not support "Dropping foreign key" out of the box, we do not generate automatic migration for that, so it has to be done manually
33+ Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
44+ https://www.sqlite.org/lang_altertable.html
55+66+ Due to that we don't generate migration automatically and it has to be done manually
77+*/
88+99+ALTER TABLE `monitor` RENAME TO `monitor_old`;
1010+--> statement-breakpoint
1111+1212+CREATE TABLE `monitor` (
1313+ `id` integer PRIMARY KEY NOT NULL,
1414+ `job_type` text(3) DEFAULT 'other' NOT NULL,
1515+ `periodicity` text(6) DEFAULT 'other' NOT NULL,
1616+ `status` text(2) DEFAULT 'inactive' NOT NULL,
1717+ `active` integer DEFAULT false,
1818+ `url` text(512) NOT NULL,
1919+ `name` text(256) DEFAULT '' NOT NULL,
2020+ `description` text DEFAULT '' NOT NULL,
2121+ `workspace_id` integer,
2222+ `updated_at` integer DEFAULT (strftime('%s', 'now')),
2323+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE no action
2424+);
2525+--> statement-breakpoint
2626+2727+INSERT INTO `monitor` SELECT `id`,`job_type`,`periodicity`,`status`,`active`,`url`,`name`,`description`,`workspace_id`,`updated_at` FROM `monitor_old`;
2828+--> statement-breakpoint
2929+3030+ALTER TABLE `monitors_to_pages` RENAME TO `monitors_to_pages_old`;
3131+--> statement-breakpoint
3232+3333+CREATE TABLE `monitors_to_pages` (
3434+ `monitor_id` integer NOT NULL,
3535+ `page_id` integer NOT NULL,
3636+ PRIMARY KEY(`monitor_id`, `page_id`),
3737+ FOREIGN KEY (`monitor_id`) REFERENCES `monitor`(`id`) ON UPDATE no action ON DELETE no action,
3838+ FOREIGN KEY (`page_id`) REFERENCES `page`(`id`) ON UPDATE no action ON DELETE no action
3939+);
4040+--> statement-breakpoint
4141+4242+INSERT INTO `monitors_to_pages` SELECT * FROM `monitors_to_pages_old`;
4343+4444+4545+--> statement-breakpoint
4646+DROP TABLE `monitor_old`;
4747+--> statement-breakpoint
4848+4949+DROP TABLE `monitors_to_pages_old`;