38 lines
1.1 KiB
SQL
38 lines
1.1 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- You are about to drop the `_UserRoles` table. If the table is not empty, all the data it contains will be lost.
|
|
|
|
*/
|
|
-- CreateEnum
|
|
CREATE TYPE "RoleName" AS ENUM ('ADMIN', 'USER', 'MODERATOR', 'SUPPORTER_LEVEL_1', 'SUPPORTER_LEVEL_2', 'SUPPORTER_LEVEL_3', 'SUPPORTER_LEVEL_4', 'SUPPORTER_LEVEL_5', 'SUPPORTER_LEVEL_6');
|
|
|
|
-- DropForeignKey
|
|
ALTER TABLE "_UserRoles" DROP CONSTRAINT "_UserRoles_A_fkey";
|
|
|
|
-- DropForeignKey
|
|
ALTER TABLE "_UserRoles" DROP CONSTRAINT "_UserRoles_B_fkey";
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "User" ALTER COLUMN "imageUrl" DROP NOT NULL;
|
|
|
|
-- DropTable
|
|
DROP TABLE "_UserRoles";
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "_RoleToUser" (
|
|
"A" TEXT NOT NULL,
|
|
"B" TEXT NOT NULL,
|
|
|
|
CONSTRAINT "_RoleToUser_AB_pkey" PRIMARY KEY ("A","B")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "_RoleToUser_B_index" ON "_RoleToUser"("B");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "_RoleToUser" ADD CONSTRAINT "_RoleToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "Role"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "_RoleToUser" ADD CONSTRAINT "_RoleToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|