feature: Adds permission system.
This commit is contained in:
parent
be91aafb58
commit
0c279b459f
6 changed files with 122 additions and 8 deletions
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `permissionID` on the `Permission` table. All the data in the column will be lost.
|
||||
- Added the required column `permission` to the `Permission` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_Permission" (
|
||||
"permission" TEXT NOT NULL,
|
||||
"has" BOOLEAN NOT NULL,
|
||||
"userID" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
CONSTRAINT "Permission_userID_fkey" FOREIGN KEY ("userID") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_Permission" ("has", "userID") SELECT "has", "userID" FROM "Permission";
|
||||
DROP TABLE "Permission";
|
||||
ALTER TABLE "new_Permission" RENAME TO "Permission";
|
||||
PRAGMA foreign_key_check;
|
||||
PRAGMA foreign_keys=ON;
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- The primary key for the `Permission` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- Added the required column `id` to the `Permission` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_Permission" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"permission" TEXT NOT NULL,
|
||||
"has" BOOLEAN NOT NULL,
|
||||
"userID" INTEGER NOT NULL,
|
||||
CONSTRAINT "Permission_userID_fkey" FOREIGN KEY ("userID") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_Permission" ("has", "permission", "userID") SELECT "has", "permission", "userID" FROM "Permission";
|
||||
DROP TABLE "Permission";
|
||||
ALTER TABLE "new_Permission" RENAME TO "Permission";
|
||||
PRAGMA foreign_key_check;
|
||||
PRAGMA foreign_keys=ON;
|
Loading…
Add table
Add a link
Reference in a new issue