Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve conflicts in prisma schema migrations #84

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions prisma/migrations/20230619073305_ocr_fields_added/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- AlterTable
ALTER TABLE "Asset" ADD COLUMN "password" TEXT,
ADD COLUMN "port" INTEGER,
ADD COLUMN "username" TEXT;

-- CreateTable
CREATE TABLE "Bed" (
"id" SERIAL NOT NULL,
"patientExternalId" TEXT NOT NULL,
"x" INTEGER NOT NULL,
"y" INTEGER NOT NULL,
"zoom" INTEGER NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"deleted" BOOLEAN NOT NULL DEFAULT false,

CONSTRAINT "Bed_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "Bed_patientExternalId_key" ON "Bed"("patientExternalId");
44 changes: 0 additions & 44 deletions prisma/migrations/20230824071303_add_bed/migration.sql

This file was deleted.

54 changes: 54 additions & 0 deletions prisma/migrations/20230825143954_alter_bed_and_asset/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
Warnings:

- You are about to drop the column `patientExternalId` on the `Bed` table. All the data in the column will be lost.
- You are about to drop the column `x` on the `Bed` table. All the data in the column will be lost.
- You are about to drop the column `y` on the `Bed` table. All the data in the column will be lost.
- You are about to drop the column `zoom` on the `Bed` table. All the data in the column will be lost.
- A unique constraint covering the columns `[externalId]` on the table `Bed` will be added. If there are existing duplicate values, this will fail.
- Added the required column `cameraId` to the `Bed` table without a default value. This is not possible if the table is not empty.
- Added the required column `externalId` to the `Bed` table without a default value. This is not possible if the table is not empty.
- Added the required column `name` to the `Bed` table without a default value. This is not possible if the table is not empty.

*/
-- CreateEnum
CREATE TYPE "AssetType" AS ENUM ('CAMERA', 'MONITOR');

-- DropIndex
DROP INDEX "Bed_patientExternalId_key";

-- AlterTable
ALTER TABLE "Asset" ADD COLUMN "type" "AssetType" NOT NULL DEFAULT 'MONITOR',
ALTER COLUMN "port" SET DEFAULT 80;

-- AlterTable
ALTER TABLE "Bed" DROP COLUMN "patientExternalId",
DROP COLUMN "x",
DROP COLUMN "y",
DROP COLUMN "zoom",
ADD COLUMN "cameraId" INTEGER NOT NULL,
ADD COLUMN "externalId" TEXT NOT NULL,
ADD COLUMN "name" TEXT NOT NULL;

-- CreateTable
CREATE TABLE "Preset" (
"id" SERIAL NOT NULL,
"x" INTEGER NOT NULL,
"y" INTEGER NOT NULL,
"zoom" INTEGER NOT NULL DEFAULT 0,
"bedId" INTEGER NOT NULL,

CONSTRAINT "Preset_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "Preset_bedId_key" ON "Preset"("bedId");

-- CreateIndex
CREATE UNIQUE INDEX "Bed_externalId_key" ON "Bed"("externalId");

-- AddForeignKey
ALTER TABLE "Bed" ADD CONSTRAINT "Bed_cameraId_fkey" FOREIGN KEY ("cameraId") REFERENCES "Asset"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Preset" ADD CONSTRAINT "Preset_bedId_fkey" FOREIGN KEY ("bedId") REFERENCES "Bed"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
Loading