-
Notifications
You must be signed in to change notification settings - Fork 14
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 #138 from coronasafe/develop
- Loading branch information
Showing
32 changed files
with
639 additions
and
346 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
14 changes: 14 additions & 0 deletions
14
prisma/migrations/20240530063454_add_stats_vital/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 @@ | ||
-- CreateTable | ||
CREATE TABLE "VitalsStat" ( | ||
"id" SERIAL NOT NULL, | ||
"imageId" TEXT NOT NULL, | ||
"vitalsFromObservation" JSONB NOT NULL, | ||
"vitalsFromImage" JSONB NOT NULL, | ||
"gptDetails" JSONB NOT NULL, | ||
"accuracy" DOUBLE PRECISION NOT NULL, | ||
"cumulativeAccuracy" DOUBLE PRECISION NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "VitalsStat_pkey" PRIMARY KEY ("id") | ||
); |
16 changes: 16 additions & 0 deletions
16
prisma/migrations/20240609170140_change_accuracy_to_json/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,16 @@ | ||
-- Rename the existing column to a temporary name | ||
ALTER TABLE "VitalsStat" RENAME COLUMN "accuracy" TO "accuracy_temp"; | ||
ALTER TABLE "VitalsStat" RENAME COLUMN "cumulativeAccuracy" TO "cumulativeAccuracy_temp"; | ||
|
||
-- Add the new column with the Json type | ||
ALTER TABLE "VitalsStat" ADD COLUMN "accuracy" Json; | ||
ALTER TABLE "VitalsStat" ADD COLUMN "cumulativeAccuracy" Json; | ||
|
||
-- Copy the data from the old column to the new column, converting floats to JSON | ||
UPDATE "VitalsStat" SET "accuracy" = json_build_object('overall', "accuracy_temp", 'metrics', '[]'::json); | ||
UPDATE "VitalsStat" SET "cumulativeAccuracy" = json_build_object('overall', "cumulativeAccuracy_temp", 'metrics', '[]'::json); | ||
|
||
-- Drop the temporary column | ||
ALTER TABLE "VitalsStat" DROP COLUMN "accuracy_temp"; | ||
ALTER TABLE "VitalsStat" DROP COLUMN "cumulativeAccuracy_temp"; | ||
|
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
Oops, something went wrong.