CREATE TABLE "monitors" ( "id" text PRIMARY KEY NOT NULL, "user_id" text NOT NULL, "name" varchar(120) NOT NULL, "url" text NOT NULL, "company" varchar(160), "status" varchar(16) DEFAULT 'pending' NOT NULL, "status_code" integer, "uptime" varchar(32) DEFAULT '—' NOT NULL, "last_checked_at" timestamp with time zone, "notification_pref" varchar(16) DEFAULT 'none' NOT NULL, "notif_email" varchar(255), "telegram_bot_token" text, "telegram_chat_id" varchar(120), "interval_value" integer DEFAULT 5 NOT NULL, "interval_unit" varchar(8) DEFAULT 'dk' NOT NULL, "timeout" integer DEFAULT 5000 NOT NULL, "retries" integer DEFAULT 3 NOT NULL, "method" varchar(10) DEFAULT 'GET' NOT NULL, "tags" text[] DEFAULT ARRAY[]::text[] NOT NULL, "renotify_count" integer, "max_redirects" integer DEFAULT 5 NOT NULL, "ip_family" varchar(10) DEFAULT 'auto' NOT NULL, "check_ssl_expiry" boolean DEFAULT false NOT NULL, "ignore_ssl_errors" boolean DEFAULT false NOT NULL, "cache_buster" boolean DEFAULT false NOT NULL, "save_error_pages" boolean DEFAULT false NOT NULL, "save_success_pages" boolean DEFAULT false NOT NULL, "response_max_length" integer DEFAULT 1024 NOT NULL, "telegram_template" text, "email_subject" text, "email_body" text, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint ALTER TABLE "monitors" ADD CONSTRAINT "monitors_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;