HotTRDealsBackend/prisma/migrations/20251103142610_add_deal_images/migration.sql

22 lines
610 B
SQL

/*
Warnings:
- You are about to drop the column `imageUrl` on the `Deal` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Deal" DROP COLUMN "imageUrl";
-- CreateTable
CREATE TABLE "DealImage" (
"id" SERIAL NOT NULL,
"imageUrl" VARCHAR(512) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"dealId" INTEGER NOT NULL,
CONSTRAINT "DealImage_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "DealImage" ADD CONSTRAINT "DealImage_dealId_fkey" FOREIGN KEY ("dealId") REFERENCES "Deal"("id") ON DELETE CASCADE ON UPDATE CASCADE;