Skip to content

Commit b3a988e

Browse files
committed
migration
1 parent dd1bc5d commit b3a988e

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
Warnings:
3+
4+
- Added the required column `name` to the `ApiKey` table without a default value. This is not possible if the table is not empty.
5+
- Added the required column `updatedAt` to the `ApiKey` table without a default value. This is not possible if the table is not empty.
6+
7+
*/
8+
-- AlterTable
9+
ALTER TABLE "Node" ADD COLUMN "allocatedPorts" TEXT DEFAULT '[]';
10+
11+
-- RedefineTables
12+
PRAGMA defer_foreign_keys=ON;
13+
PRAGMA foreign_keys=OFF;
14+
CREATE TABLE "new_ApiKey" (
15+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
16+
"name" TEXT NOT NULL,
17+
"key" TEXT NOT NULL,
18+
"description" TEXT,
19+
"permissions" TEXT NOT NULL DEFAULT '[]',
20+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
21+
"updatedAt" DATETIME NOT NULL,
22+
"active" BOOLEAN NOT NULL DEFAULT true,
23+
"userId" INTEGER,
24+
CONSTRAINT "ApiKey_userId_fkey" FOREIGN KEY ("userId") REFERENCES "Users" ("id") ON DELETE SET NULL ON UPDATE CASCADE
25+
);
26+
INSERT INTO "new_ApiKey" ("active", "createdAt", "id", "key") SELECT "active", "createdAt", "id", "key" FROM "ApiKey";
27+
DROP TABLE "ApiKey";
28+
ALTER TABLE "new_ApiKey" RENAME TO "ApiKey";
29+
CREATE UNIQUE INDEX "ApiKey_key_key" ON "ApiKey"("key");
30+
CREATE TABLE "new_Server" (
31+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
32+
"UUID" TEXT NOT NULL,
33+
"name" TEXT NOT NULL,
34+
"description" TEXT,
35+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
36+
"Ports" TEXT NOT NULL,
37+
"Memory" INTEGER NOT NULL,
38+
"Cpu" INTEGER NOT NULL,
39+
"Storage" INTEGER NOT NULL,
40+
"Variables" TEXT,
41+
"StartCommand" TEXT,
42+
"dockerImage" TEXT,
43+
"allowStartupEdit" BOOLEAN NOT NULL DEFAULT false,
44+
"Installing" BOOLEAN NOT NULL DEFAULT true,
45+
"Queued" BOOLEAN NOT NULL DEFAULT true,
46+
"Suspended" BOOLEAN NOT NULL DEFAULT false,
47+
"ownerId" INTEGER NOT NULL,
48+
"nodeId" INTEGER NOT NULL,
49+
"imageId" INTEGER NOT NULL,
50+
CONSTRAINT "Server_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES "Node" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
51+
CONSTRAINT "Server_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "Users" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
52+
CONSTRAINT "Server_imageId_fkey" FOREIGN KEY ("imageId") REFERENCES "Images" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
53+
);
54+
INSERT INTO "new_Server" ("Cpu", "Installing", "Memory", "Ports", "Queued", "StartCommand", "Storage", "Suspended", "UUID", "Variables", "createdAt", "description", "dockerImage", "id", "imageId", "name", "nodeId", "ownerId") SELECT "Cpu", "Installing", "Memory", "Ports", "Queued", "StartCommand", "Storage", "Suspended", "UUID", "Variables", "createdAt", "description", "dockerImage", "id", "imageId", "name", "nodeId", "ownerId" FROM "Server";
55+
DROP TABLE "Server";
56+
ALTER TABLE "new_Server" RENAME TO "Server";
57+
CREATE UNIQUE INDEX "Server_UUID_key" ON "Server"("UUID");
58+
PRAGMA foreign_keys=ON;
59+
PRAGMA defer_foreign_keys=OFF;

prisma/migrations/migration_lock.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Please do not edit this file manually
22
# It should be added in your version-control system (e.g., Git)
3-
provider = "sqlite"
3+
provider = "sqlite"

0 commit comments

Comments
 (0)