chore: update migration
This commit is contained in:
parent
28d002ad65
commit
31ed48d190
4 changed files with 91 additions and 13 deletions
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `serviceId` on the `Work` table. All the data in the column will be lost.
|
||||
- Added the required column `order` to the `WorkProduct` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Work" DROP CONSTRAINT "Work_serviceId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Work" DROP COLUMN "serviceId";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "WorkProduct" ADD COLUMN "order" INTEGER NOT NULL;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "WorkService" (
|
||||
"id" TEXT NOT NULL,
|
||||
"order" INTEGER NOT NULL,
|
||||
"workId" TEXT NOT NULL,
|
||||
"serviceId" TEXT NOT NULL,
|
||||
"createdBy" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updateBy" TEXT,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"productId" TEXT,
|
||||
|
||||
CONSTRAINT "WorkService_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "WorkService" ADD CONSTRAINT "WorkService_workId_fkey" FOREIGN KEY ("workId") REFERENCES "Work"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "WorkService" ADD CONSTRAINT "WorkService_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "Service"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `order` on the `Work` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "Work" DROP COLUMN "order";
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- The primary key for the `WorkProduct` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- You are about to drop the column `id` on the `WorkProduct` table. All the data in the column will be lost.
|
||||
- The primary key for the `WorkService` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- You are about to drop the column `id` on the `WorkService` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "WorkProduct" DROP CONSTRAINT "WorkProduct_pkey",
|
||||
DROP COLUMN "id",
|
||||
ADD CONSTRAINT "WorkProduct_pkey" PRIMARY KEY ("workId", "productId");
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "WorkService" DROP CONSTRAINT "WorkService_pkey",
|
||||
DROP COLUMN "id",
|
||||
ADD CONSTRAINT "WorkService_pkey" PRIMARY KEY ("workId", "serviceId");
|
||||
Loading…
Add table
Add a link
Reference in a new issue