Implement PostgreSQL support and update database configuration: Migrate from SQLite to PostgreSQL by updating the Prisma schema, Docker configuration, and environment variables. Add PostgreSQL dependencies and adjust the database connection logic in the application. Enhance .gitignore to exclude PostgreSQL-related files and directories.
Some checks failed
Deploy with Docker Compose / deploy (push) Has been cancelled

This commit is contained in:
Julien Froidefond
2025-12-17 11:41:32 +01:00
parent 1f59cc7f9d
commit 8ad09ab9c8
45 changed files with 1238 additions and 109 deletions

View File

@@ -0,0 +1,45 @@
-- AlterTable
-- SQLite ne supporte pas directement le changement de type, donc on doit recréer la table
-- On convertit les dates string ISO en datetime
-- Créer une nouvelle table avec le bon type
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,
"status" TEXT NOT NULL,
"room" TEXT,
"time" TEXT,
"maxPlaces" INTEGER,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
-- Copier les données en convertissant les dates string en datetime
INSERT INTO "Event_new" ("id", "date", "name", "description", "type", "status", "room", "time", "maxPlaces", "createdAt", "updatedAt")
SELECT
"id",
datetime("date") as "date",
"name",
"description",
"type",
"status",
"room",
"time",
"maxPlaces",
"createdAt",
"updatedAt"
FROM "Event";
-- Supprimer l'ancienne table
DROP TABLE "Event";
-- Renommer la nouvelle table
ALTER TABLE "Event_new" RENAME TO "Event";
-- Recréer les index
CREATE INDEX "Event_status_idx" ON "Event"("status");
CREATE INDEX "Event_date_idx" ON "Event"("date");