imkFinal/backend/prisma/migrations/20241029014126_simplify_document_schema/migration.sql
dimitar 3e298a1eef final version
needs file status update[pending, finished]
2025-02-24 23:43:50 +01:00

29 lines
1.1 KiB
SQL

/*
Warnings:
- You are about to drop the column `authorId` on the `Document` table. All the data in the column will be lost.
- You are about to drop the column `published` on the `Document` table. All the data in the column will be lost.
- You are about to drop the `_SharedDocuments` table. If the table is not empty, all the data it contains will be lost.
- Added the required column `sharedWithId` to the `Document` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Document" DROP CONSTRAINT "Document_authorId_fkey";
-- DropForeignKey
ALTER TABLE "_SharedDocuments" DROP CONSTRAINT "_SharedDocuments_A_fkey";
-- DropForeignKey
ALTER TABLE "_SharedDocuments" DROP CONSTRAINT "_SharedDocuments_B_fkey";
-- AlterTable
ALTER TABLE "Document" DROP COLUMN "authorId",
DROP COLUMN "published",
ADD COLUMN "sharedWithId" INTEGER NOT NULL;
-- DropTable
DROP TABLE "_SharedDocuments";
-- AddForeignKey
ALTER TABLE "Document" ADD CONSTRAINT "Document_sharedWithId_fkey" FOREIGN KEY ("sharedWithId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;