34 lines
1.1 KiB
SQL
34 lines
1.1 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- You are about to drop the column `responsibleArea` on the `User` table. All the data in the column will be lost.
|
|
|
|
*/
|
|
-- AlterTable
|
|
ALTER TABLE "User" DROP COLUMN "responsibleArea";
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "UserResponsibleArea" (
|
|
"id" TEXT NOT NULL,
|
|
"area" TEXT NOT NULL,
|
|
|
|
CONSTRAINT "UserResponsibleArea_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "_UserToUserResponsibleArea" (
|
|
"A" TEXT NOT NULL,
|
|
"B" TEXT NOT NULL
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "_UserToUserResponsibleArea_AB_unique" ON "_UserToUserResponsibleArea"("A", "B");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "_UserToUserResponsibleArea_B_index" ON "_UserToUserResponsibleArea"("B");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "_UserToUserResponsibleArea" ADD CONSTRAINT "_UserToUserResponsibleArea_A_fkey" FOREIGN KEY ("A") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "_UserToUserResponsibleArea" ADD CONSTRAINT "_UserToUserResponsibleArea_B_fkey" FOREIGN KEY ("B") REFERENCES "UserResponsibleArea"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|