Files
2026-06-10 09:39:20 -03:00

24 lines
873 B
SQL

-- CreateTable
CREATE TABLE "court_maintenances" (
"id" UUID NOT NULL,
"court_id" UUID NOT NULL,
"start_date" DATE NOT NULL,
"start_time" VARCHAR(5),
"end_time" VARCHAR(5),
"reason" VARCHAR(500),
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "court_maintenances_pkey" PRIMARY KEY ("id")
);
-- AlterTable
ALTER TABLE "courts" ADD COLUMN "is_under_maintenance" BOOLEAN NOT NULL DEFAULT false;
ALTER TABLE "courts" ADD COLUMN "maintenance_reason" VARCHAR(500);
-- CreateIndex
CREATE INDEX "court_maintenances_court_id_start_date_idx" ON "court_maintenances"("court_id", "start_date");
-- AddForeignKey
ALTER TABLE "court_maintenances" ADD CONSTRAINT "court_maintenances_court_id_fkey" FOREIGN KEY ("court_id") REFERENCES "courts"("id") ON DELETE CASCADE ON UPDATE CASCADE;