x
This commit is contained in:
1 parent
ed69a4b840
commit
992335a52b
22 files changed
+1064
-346
No files matched your search
+72
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `scentId` on the `Product` table. All the data in the column will be lost.
|
||||
- You are about to drop the `Hero` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `HeroTranslation` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Scent` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `ScentTranslation` table. If the table is not empty, all the data it contains will be lost.
|
||||
- Added the required column `brandId` to the `Product` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "HeroTranslation" DROP CONSTRAINT "HeroTranslation_heroId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Product" DROP CONSTRAINT "Product_scentId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "ScentTranslation" DROP CONSTRAINT "ScentTranslation_scentId_fkey";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "Product_scentId_categoryId_key";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Product" DROP COLUMN "scentId",
|
||||
ADD COLUMN "brandId" INTEGER NOT NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Hero";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "HeroTranslation";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Scent";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "ScentTranslation";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "ProductBrand" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "ProductBrand_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "ProductBrandTranslation" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"brandId" INTEGER NOT NULL,
|
||||
"langCode" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "ProductBrandTranslation_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ProductBrand_name_key" ON "ProductBrand"("name");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ProductBrandTranslation_brandId_langCode_key" ON "ProductBrandTranslation"("brandId", "langCode");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ProductBrandTranslation" ADD CONSTRAINT "ProductBrandTranslation_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "ProductBrand"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Product" ADD CONSTRAINT "Product_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "ProductBrand"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
Reference in new issue
Block a user