/opt/canhelp/packages/db/migrations
Edit: /opt/canhelp/packages/db/migrations/0005_support_tickets.sql (821B)
CREATE TABLE IF NOT EXISTS "support_tickets" (
"id" text PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"type" varchar(20) DEFAULT 'bug' NOT NULL,
"subject" text NOT NULL,
"body" text NOT NULL,
"status" varchar(20) DEFAULT 'open' NOT NULL,
"admin_reply" text,
"admin_id" text,
"replied_at" timestamp,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "support_tickets" ADD CONSTRAINT "support_tickets_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
--> statement-breakpoint
ALTER TABLE "support_tickets" ADD CONSTRAINT "support_tickets_admin_id_users_id_fk" FOREIGN KEY ("admin_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;