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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user