diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 0f05f7c..9103390 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -118,6 +118,17 @@ jobs: cache-from: type=registry,ref=git.farh.net/groombook/cache:migrate cache-to: type=registry,ref=git.farh.net/groombook/cache:migrate,mode=max + - name: Smoke test migrate image (blackhole npmjs.org) + run: | + set -euo pipefail + IMAGE="git.farh.net/groombook/migrate:${{ steps.version.outputs.tag }}" + docker pull "$IMAGE" + docker run --rm \ + --add-host registry.npmjs.org:127.0.0.1 \ + --entrypoint="" \ + "$IMAGE" \ + pnpm --version + - name: Build and push Seed image uses: docker/build-push-action@v6 with: diff --git a/packages/db/migrations/0035_add_short_to_coat_type_enum.sql b/packages/db/migrations/0035_add_short_to_coat_type_enum.sql new file mode 100644 index 0000000..26145a9 --- /dev/null +++ b/packages/db/migrations/0035_add_short_to_coat_type_enum.sql @@ -0,0 +1,14 @@ +-- Migration: 0035_add_short_to_coat_type_enum.sql +-- GRO-1953: Adds missing "short" value to the coat_type enum so that seed data +-- (which uses coatTypePool including "short") can be inserted without error. +-- +-- The seed file defines coatTypePool as: +-- ["short", "medium", "long", "double", "wire", "silky", "curly", "hairless"] +-- but migration 0031 created the enum without "short", causing: +-- PostgresError: invalid input value for enum coat_type: "short" + +BEGIN; + +ALTER TYPE "coat_type" ADD VALUE IF NOT EXISTS 'short'; + +COMMIT; \ No newline at end of file diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index db9e36c..58d27a7 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -246,6 +246,13 @@ "when": 1751140800000, "tag": "0034_extend_pet_profile_columns", "breakpoints": true + }, + { + "idx": 35, + "version": "7", + "when": 1751140800000, + "tag": "0035_add_short_to_coat_type_enum", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/src/seed.ts b/packages/db/src/seed.ts index 375ffe1..0264c19 100644 --- a/packages/db/src/seed.ts +++ b/packages/db/src/seed.ts @@ -270,6 +270,10 @@ const medicalAlertPool: MedicalAlert[] = [ { id: "", type: "other", description: "Seizure history — avoid flashing lights", severity: "high" }, { id: "", type: "other", description: "Luxating patella — short walks only", severity: "medium" }, { id: "", type: "other", description: "Ear infections — dry thoroughly after bath", severity: "low" }, + { id: "", type: "behavioral", description: "Anxiety — calm environment preferred", severity: "low" }, + { id: "", type: "behavioral", description: "Fear-based aggression — approach with caution", severity: "high" }, + { id: "", type: "skin", description: "Contact dermatitis — avoid harsh chemicals", severity: "medium" }, + { id: "", type: "skin", description: "Hot spots — monitor and report any worsening", severity: "high" }, ]; const preferredCutPool: string[] = [ @@ -1058,6 +1062,14 @@ async function seed() { temperamentScore: randInt(1, 5), temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)), medicalAlerts: (() => { + // Deterministic alerts for UAT AC pets + if (uc.petName === "TestCooper") { + return pickN(medicalAlertPool.filter((a) => a.type === "behavioral"), 1).map((a) => ({ ...a, id: uuid() })); + } + if (uc.petName === "TestRocky") { + return pickN(medicalAlertPool.filter((a) => a.type === "skin"), 1).map((a) => ({ ...a, id: uuid() })); + } + // Other UAT pets: random if (rand() < 0.3) { const count = rand() < 0.7 ? 1 : 2; return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() }));