feat: add reports table schema for preset reporting
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
CREATE TYPE "public"."report_reason" AS ENUM('inaccurate', 'spam', 'inappropriate', 'other');--> statement-breakpoint
|
||||
CREATE TYPE "public"."report_status" AS ENUM('open', 'reviewed', 'dismissed');--> statement-breakpoint
|
||||
CREATE TABLE "reports" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"entry_id" text NOT NULL,
|
||||
"reporter_id" text NOT NULL,
|
||||
"reason" "report_reason" NOT NULL,
|
||||
"details" text,
|
||||
"status" "report_status" DEFAULT 'open' NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "reports" ADD CONSTRAINT "reports_entry_id_performance_entries_id_fk" FOREIGN KEY ("entry_id") REFERENCES "public"."performance_entries"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "reports" ADD CONSTRAINT "reports_reporter_id_user_id_fk" FOREIGN KEY ("reporter_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "reports_entry_reporter_unique" ON "reports" USING btree ("entry_id","reporter_id");
|
||||
Reference in New Issue
Block a user