CREATE TABLE "live_kill_switches" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"tenant_id" uuid,
	"target_type" text NOT NULL,
	"target_id" text NOT NULL,
	"reason" text,
	"issued_by" text NOT NULL,
	"expires_at" timestamp,
	"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "network_telemetry" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"tenant_id" uuid,
	"user_id" uuid,
	"endpoint" text NOT NULL,
	"method" text NOT NULL,
	"response_time_ms" text NOT NULL,
	"status_code" text NOT NULL,
	"ip_address" text NOT NULL,
	"geo_region" text,
	"traffic_bytes" text NOT NULL,
	"timestamp" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "quantum_logs" ADD COLUMN "tenant_id" uuid;--> statement-breakpoint
ALTER TABLE "live_kill_switches" ADD CONSTRAINT "live_kill_switches_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "network_telemetry" ADD CONSTRAINT "network_telemetry_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "network_telemetry" ADD CONSTRAINT "network_telemetry_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "quantum_logs" ADD CONSTRAINT "quantum_logs_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;