uup
This commit is contained in:
31
prisma/migrations/20250827220800_newdis2/migration.sql
Normal file
31
prisma/migrations/20250827220800_newdis2/migration.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `maintenanceTypeId` on the `maintenance_visits` table. All the data in the column will be lost.
|
||||
- Added the required column `maintenanceJobs` to the `maintenance_visits` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_maintenance_visits" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"vehicleId" INTEGER NOT NULL,
|
||||
"customerId" INTEGER NOT NULL,
|
||||
"maintenanceJobs" TEXT NOT NULL,
|
||||
"description" TEXT NOT NULL,
|
||||
"cost" REAL NOT NULL,
|
||||
"paymentStatus" TEXT NOT NULL DEFAULT 'pending',
|
||||
"kilometers" INTEGER NOT NULL,
|
||||
"visitDate" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"nextVisitDelay" INTEGER NOT NULL,
|
||||
"createdDate" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updateDate" DATETIME NOT NULL,
|
||||
CONSTRAINT "maintenance_visits_vehicleId_fkey" FOREIGN KEY ("vehicleId") REFERENCES "vehicles" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT "maintenance_visits_customerId_fkey" FOREIGN KEY ("customerId") REFERENCES "customers" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_maintenance_visits" ("cost", "createdDate", "customerId", "description", "id", "kilometers", "nextVisitDelay", "paymentStatus", "updateDate", "vehicleId", "visitDate") SELECT "cost", "createdDate", "customerId", "description", "id", "kilometers", "nextVisitDelay", "paymentStatus", "updateDate", "vehicleId", "visitDate" FROM "maintenance_visits";
|
||||
DROP TABLE "maintenance_visits";
|
||||
ALTER TABLE "new_maintenance_visits" RENAME TO "maintenance_visits";
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
Reference in New Issue
Block a user