Skip to content

Commit

Permalink
Fix database migration drift (#166)
Browse files Browse the repository at this point in the history
* Pagination bug

* Bug fix

* Bugfixes

* Fix migration drift
  • Loading branch information
karthikscale3 committed Jul 3, 2024
1 parent 2f3aa0c commit c16ff66
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
/*
Warnings:
- You are about to drop the column `expectedOutput` on the `Data` table. All the data in the column will be lost.
- You are about to drop the column `runId` on the `Data` table. All the data in the column will be lost.
- You are about to drop the column `name` on the `Run` table. All the data in the column will be lost.
- A unique constraint covering the columns `[apiKeyHash]` on the table `Team` will be added. If there are existing duplicate values, this will fail.
- Added the required column `projectId` to the `Run` table without a default value. This is not possible if the table is not empty.
- Added the required column `runId` to the `Run` table without a default value. This is not possible if the table is not empty.
- Added the required column `taskId` to the `Run` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `Run` table without a default value. This is not possible if the table is not empty.
*/

-- AlterTable
ALTER TABLE "Team" ADD COLUMN "apiKeyHash" TEXT;
ALTER TABLE "Team" ADD COLUMN "apiKeyHash" TEXT;

-- CreateIndex
CREATE UNIQUE INDEX "Team_apiKeyHash_key" ON "Team"("apiKeyHash");
Expand Down
36 changes: 36 additions & 0 deletions prisma/migrations/20240703045034_add_api_key_hash/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Warnings:
- You are about to drop the column `expectedOutput` on the `Data` table. All the data in the column will be lost.
- You are about to drop the column `runId` on the `Data` table. All the data in the column will be lost.
- You are about to drop the column `name` on the `Run` table. All the data in the column will be lost.
- Added the required column `projectId` to the `Run` table without a default value. This is not possible if the table is not empty.
- Added the required column `runId` to the `Run` table without a default value. This is not possible if the table is not empty.
- Added the required column `taskId` to the `Run` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `Run` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Data" DROP CONSTRAINT "Data_runId_fkey";

-- AlterTable
ALTER TABLE "Data" DROP COLUMN "expectedOutput",
DROP COLUMN "runId",
ADD COLUMN "annotatedOutput" TEXT;

-- AlterTable
ALTER TABLE "Run" DROP COLUMN "name",
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "datasetId" TEXT,
ADD COLUMN "log" JSONB,
ADD COLUMN "projectId" TEXT NOT NULL,
ADD COLUMN "runId" TEXT NOT NULL,
ADD COLUMN "taskId" TEXT NOT NULL,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL,
ADD COLUMN "wfVersion" TEXT;

-- AddForeignKey
ALTER TABLE "Run" ADD CONSTRAINT "Run_datasetId_fkey" FOREIGN KEY ("datasetId") REFERENCES "Dataset"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Run" ADD CONSTRAINT "Run_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;

0 comments on commit c16ff66

Please sign in to comment.