/*
  Warnings:

  - You are about to drop the column `status` on the `notifications` table. All the data in the column will be lost.
  - You are about to drop the `_UserHasNotifications` table. If the table is not empty, all the data it contains will be lost.

*/
-- DropForeignKey
ALTER TABLE "_UserHasNotifications" DROP CONSTRAINT "_UserHasNotifications_A_fkey";

-- DropForeignKey
ALTER TABLE "_UserHasNotifications" DROP CONSTRAINT "_UserHasNotifications_B_fkey";

-- AlterTable
ALTER TABLE "notifications" DROP COLUMN "status";

-- DropTable
DROP TABLE "_UserHasNotifications";

-- CreateTable
CREATE TABLE "user_notifications" (
    "uid" TEXT NOT NULL,
    "user_uid" VARCHAR(255) NOT NULL,
    "read" BOOLEAN NOT NULL DEFAULT false,
    "notification_uid" VARCHAR(255) NOT NULL,

    CONSTRAINT "user_notifications_pkey" PRIMARY KEY ("uid")
);

-- CreateIndex
CREATE UNIQUE INDEX "user_notifications_uid_key" ON "user_notifications"("uid");

-- AddForeignKey
ALTER TABLE "user_notifications" ADD CONSTRAINT "user_notifications_user_uid_fkey" FOREIGN KEY ("user_uid") REFERENCES "users"("uid") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "user_notifications" ADD CONSTRAINT "user_notifications_notification_uid_fkey" FOREIGN KEY ("notification_uid") REFERENCES "notifications"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
