feat: create community suggestions table

This commit is contained in:
2026-04-30 19:07:54 +08:00
parent 33b0198506
commit 4e324fa6e0
5 changed files with 2083 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
CREATE TYPE "public"."suggestion_status" AS ENUM('pending', 'approved', 'rejected');--> statement-breakpoint
CREATE TABLE "community_suggestions" (
"id" text PRIMARY KEY NOT NULL,
"game_id" text NOT NULL,
"user_id" text NOT NULL,
"field_name" text NOT NULL,
"current_value" text,
"proposed_value" text NOT NULL,
"reason" text,
"status" "suggestion_status" DEFAULT 'pending' NOT NULL,
"reviewed_by" text,
"reviewed_at" timestamp,
"review_note" text,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "community_suggestions" ADD CONSTRAINT "community_suggestions_game_id_games_id_fk" FOREIGN KEY ("game_id") REFERENCES "public"."games"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "community_suggestions" ADD CONSTRAINT "community_suggestions_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "community_suggestions" ADD CONSTRAINT "community_suggestions_reviewed_by_user_id_fk" FOREIGN KEY ("reviewed_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "community_suggestions_game_field_user" ON "community_suggestions" USING btree ("game_id","field_name","user_id");
File diff suppressed because it is too large Load Diff
+7
View File
@@ -134,6 +134,13 @@
"when": 1777547028555,
"tag": "0018_slimy_proemial_gods",
"breakpoints": true
},
{
"idx": 19,
"version": "7",
"when": 1777547264277,
"tag": "0019_tiresome_genesis",
"breakpoints": true
}
]
}