-- AlterTable ALTER TABLE "event_participants" ADD COLUMN "recorder_opt_out" BOOLEAN NOT NULL DEFAULT false; -- AlterTable ALTER TABLE "events" ADD COLUMN "matching_run_at" TIMESTAMP(3), ADD COLUMN "registration_deadline" TIMESTAMP(3); -- CreateTable CREATE TABLE "recording_suggestions" ( "id" SERIAL NOT NULL, "event_id" INTEGER NOT NULL, "heat_id" INTEGER NOT NULL, "recorder_id" INTEGER, "status" VARCHAR(20) NOT NULL DEFAULT 'pending', "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updated_at" TIMESTAMP(3) NOT NULL, CONSTRAINT "recording_suggestions_pkey" PRIMARY KEY ("id") ); -- CreateIndex CREATE UNIQUE INDEX "recording_suggestions_heat_id_key" ON "recording_suggestions"("heat_id"); -- CreateIndex CREATE INDEX "recording_suggestions_event_id_idx" ON "recording_suggestions"("event_id"); -- CreateIndex CREATE INDEX "recording_suggestions_recorder_id_idx" ON "recording_suggestions"("recorder_id"); -- AddForeignKey ALTER TABLE "recording_suggestions" ADD CONSTRAINT "recording_suggestions_event_id_fkey" FOREIGN KEY ("event_id") REFERENCES "events"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "recording_suggestions" ADD CONSTRAINT "recording_suggestions_heat_id_fkey" FOREIGN KEY ("heat_id") REFERENCES "event_user_heats"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "recording_suggestions" ADD CONSTRAINT "recording_suggestions_recorder_id_fkey" FOREIGN KEY ("recorder_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;