borders/prisma/migrations/20220410181303_/migration.sql

24 lines
1008 B
SQL

/*
Warnings:
- Added the required column `discordId` to the `ApplicationUserData` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_ApplicationUserData" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"userId" TEXT NOT NULL,
"discordId" TEXT NOT NULL,
"borderUrl" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_ApplicationUserData" ("borderUrl", "createdAt", "id", "updatedAt", "userId") SELECT "borderUrl", "createdAt", "id", "updatedAt", "userId" FROM "ApplicationUserData";
DROP TABLE "ApplicationUserData";
ALTER TABLE "new_ApplicationUserData" RENAME TO "ApplicationUserData";
CREATE UNIQUE INDEX "ApplicationUserData_userId_key" ON "ApplicationUserData"("userId");
CREATE UNIQUE INDEX "ApplicationUserData_discordId_key" ON "ApplicationUserData"("discordId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;