Refactor event status handling: Remove EventStatus enum from the Prisma schema and update related API routes and UI components to calculate event status dynamically based on event date. This change simplifies event management and enhances data integrity by ensuring status is always derived from the date.

This commit is contained in:
Julien Froidefond
2025-12-10 05:45:25 +01:00
parent fb830c6fcc
commit a69613a232
15 changed files with 167 additions and 298 deletions

View File

@@ -0,0 +1,20 @@
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "_Event_new" (
"id" TEXT NOT NULL PRIMARY KEY,
"date" DATETIME NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT NOT NULL,
"type" TEXT NOT NULL,
"room" TEXT,
"time" TEXT,
"maxPlaces" INTEGER,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "_Event_new" ("id", "date", "name", "description", "type", "room", "time", "maxPlaces", "createdAt", "updatedAt") SELECT "id", "date", "name", "description", "type", "room", "time", "maxPlaces", "createdAt", "updatedAt" FROM "Event";
DROP TABLE "Event";
ALTER TABLE "_Event_new" RENAME TO "Event";
CREATE INDEX "Event_date_idx" ON "Event"("date");
PRAGMA foreign_keys=ON;