1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

[PM-5519] [PM-5526] [PM-5624] [PM-5600] More Grant SQL fixes (#3668)

* SQLite scripts to apply autoincrementing Id key

* Drop erroneous Id column if created
This commit is contained in:
Matt Bishop
2024-01-16 09:08:55 -05:00
committed by GitHub
parent c12c09897b
commit b97a1a9ed2
6 changed files with 119 additions and 92 deletions

View File

@ -0,0 +1,46 @@
ALTER TABLE
"Grant" RENAME TO "Old_Grant";
CREATE TABLE "Grant"
(
"Id" INTEGER PRIMARY KEY AUTOINCREMENT,
"Key" TEXT NOT NULL,
"Type" TEXT NOT NULL,
"SubjectId" TEXT NULL,
"SessionId" TEXT NULL,
"ClientId" TEXT NOT NULL,
"Description" TEXT NULL,
"CreationDate" TEXT NOT NULL,
"ExpirationDate" TEXT NULL,
"ConsumedDate" TEXT NULL,
"Data" TEXT NOT NULL
);
INSERT INTO
"Grant"
(
"Key",
"Type",
"SubjectId",
"SessionId",
"ClientId",
"Description",
"CreationDate",
"ExpirationDate",
"ConsumedDate",
"Data"
)
SELECT
"Key",
"Type",
"SubjectId",
"SessionId",
"ClientId",
"Description",
"CreationDate",
"ExpirationDate",
"ConsumedDate",
"Data"
FROM "Old_Grant";
DROP TABLE "Old_Grant";