-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3173 from quantified-uncertainty/modelExports-ren…
…aming ModelExport -> VariableRevision, new Variable Table
- Loading branch information
Showing
47 changed files
with
830 additions
and
746 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/hub/prisma/migrations/20240412183853_mode_export_to_variables/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the `ModelExport` table. If the table is not empty, all the data it contains will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "ModelExport" DROP CONSTRAINT "ModelExport_modelRevisionId_fkey"; | ||
|
||
-- DropTable | ||
DROP TABLE "ModelExport"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Variable" ( | ||
"id" TEXT NOT NULL, | ||
"variableName" TEXT NOT NULL, | ||
"modelId" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Variable_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "VariableRevision" ( | ||
"id" TEXT NOT NULL, | ||
"modelRevisionId" TEXT NOT NULL, | ||
"variableId" TEXT NOT NULL, | ||
"variableName" TEXT NOT NULL, | ||
"title" TEXT, | ||
"docstring" TEXT NOT NULL DEFAULT '', | ||
"variableType" TEXT NOT NULL DEFAULT 'OTHER', | ||
|
||
CONSTRAINT "VariableRevision_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Variable_modelId_variableName_key" ON "Variable"("modelId", "variableName"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "VariableRevision_modelRevisionId_variableName_key" ON "VariableRevision"("modelRevisionId", "variableName"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Variable" ADD CONSTRAINT "Variable_modelId_fkey" FOREIGN KEY ("modelId") REFERENCES "Model"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "VariableRevision" ADD CONSTRAINT "VariableRevision_modelRevisionId_fkey" FOREIGN KEY ("modelRevisionId") REFERENCES "ModelRevision"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "VariableRevision" ADD CONSTRAINT "VariableRevision_variableId_fkey" FOREIGN KEY ("variableId") REFERENCES "Variable"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
14 changes: 14 additions & 0 deletions
14
packages/hub/prisma/migrations/20240413012803_variable_current_revision_id/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
Warnings: | ||
- A unique constraint covering the columns `[currentRevisionId]` on the table `Variable` will be added. If there are existing duplicate values, this will fail. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Variable" ADD COLUMN "currentRevisionId" TEXT; | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Variable_currentRevisionId_key" ON "Variable"("currentRevisionId"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Variable" ADD CONSTRAINT "Variable_currentRevisionId_fkey" FOREIGN KEY ("currentRevisionId") REFERENCES "VariableRevision"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.