2022-12-01 23:07:49 +01:00
|
|
|
/*
|
|
|
|
Warnings:
|
|
|
|
|
|
|
|
- You are about to drop the column `firstName` on the `User` table. All the data in the column will be lost.
|
|
|
|
- You are about to drop the column `lastName` on the `User` table. All the data in the column will be lost.
|
|
|
|
- Added the required column `username` to the `User` table without a default value. This is not possible if the table is not empty.
|
|
|
|
|
|
|
|
*/
|
|
|
|
-- CreateTable
|
|
|
|
CREATE TABLE "Config" (
|
|
|
|
"updatedAt" DATETIME NOT NULL,
|
|
|
|
"key" TEXT NOT NULL PRIMARY KEY,
|
|
|
|
"type" TEXT NOT NULL,
|
|
|
|
"value" TEXT NOT NULL,
|
|
|
|
"description" TEXT NOT NULL,
|
|
|
|
"secret" BOOLEAN NOT NULL DEFAULT true,
|
|
|
|
"locked" BOOLEAN NOT NULL DEFAULT false
|
|
|
|
);
|
|
|
|
|
|
|
|
-- RedefineTables
|
|
|
|
PRAGMA foreign_keys=OFF;
|
|
|
|
CREATE TABLE "new_User" (
|
|
|
|
"id" TEXT NOT NULL PRIMARY KEY,
|
|
|
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
"updatedAt" DATETIME NOT NULL,
|
|
|
|
"username" TEXT NOT NULL,
|
|
|
|
"email" TEXT NOT NULL,
|
|
|
|
"password" TEXT NOT NULL,
|
|
|
|
"isAdmin" BOOLEAN NOT NULL DEFAULT false
|
|
|
|
);
|
2022-12-02 23:00:24 +01:00
|
|
|
INSERT INTO "new_User" ("createdAt", "email", "id", "password", "updatedAt", "username") SELECT "createdAt", "email", "id", "password", "updatedAt", 'user-' || User.id as "username" FROM "User";
|
2022-12-01 23:07:49 +01:00
|
|
|
DROP TABLE "User";
|
|
|
|
ALTER TABLE "new_User" RENAME TO "User";
|
|
|
|
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");
|
|
|
|
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
|
|
|
PRAGMA foreign_key_check;
|
|
|
|
PRAGMA foreign_keys=ON;
|