fix(db): add extra_large to pet_size_category enum (GRO-1999)
GRO-1999: UAT seed-test-data job (image 2026.05.31-5390131) crashes with 22P02 'invalid input value for enum pet_size_category: "extra_large"'. seed.ts petSizeCategoryPool and the drizzle schema both use 'extra_large', but migration 0031_buffer_rules.sql created the enum with 'xlarge' instead — same migration drift pattern that GRO-1971 fixed for coat_type. Add migration 0037_add_extra_large_to_pet_size_category.sql that ALTERs the enum to add the missing 'extra_large' value (idempotent, auto-commit because Postgres forbids ALTER TYPE ADD VALUE inside a transaction block). Register idx 37 in the drizzle journal. Mirror the UAT_PLAYBOOK entry from GRO-1971: TC-API-3.28 verifies the pet_size_category enum has all 4 values used by seed.ts after the seed job completes, so future enum drift is caught at the UAT gate. Refs: GRO-1950 (UAT regression that surfaced this), GRO-1971 (pattern this fix mirrors), GRO-1979 (parallel fix landed on a different branch via PR #124 — this is the GRO-1983 baseline equivalent). Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -119,6 +119,7 @@ GroomBook API is a Hono-based REST service (TypeScript/Node.js) powering the pet
|
||||
| TC-API-3.25 | Verify 30+ total pets in UAT DB | GET /api/pets then count total | 30+ pets returned (UAT seed creates 500 random-pool + 5 UAT test clients + 2 UAT customer = 507 total) |
|
||||
| TC-API-3.26 | Verify 25-35% medicalAlerts distribution | GET /api/pets (first 30 pets), count how many have non-empty medicalAlerts | Ratio is 25-35% (seed uses rand() < 0.3 for ~30% distribution) |
|
||||
| TC-API-3.27 | Verify coat_type enum has all seed values | After UAT seed completes, inspect the coat_type enum on the UAT DB — it must contain: short, medium, long, double, wire, silky, curly, hairless | UAT seed jobs (`reset-demo-data`, `seed-test-data`) complete 1/1 with no `enum_in` error; coat_type includes all 8 values used by seed.ts `coatTypePool` |
|
||||
| TC-API-3.28 | Verify pet_size_category enum has all seed values | After UAT seed completes, inspect the pet_size_category enum on the UAT DB — it must contain: small, medium, large, extra_large | UAT seed jobs (`reset-demo-data`, `seed-test-data`) complete 1/1 with no `enum_in` error; pet_size_category includes all 4 values used by seed.ts `petSizeCategoryPool` (regression for GRO-1999, mirrors TC-API-3.27) |
|
||||
|
||||
### 4.4 Appointment Scheduling
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
-- Migration: 0037_add_extra_large_to_pet_size_category.sql
|
||||
-- GRO-1999: Adds the 'extra_large' value to the pet_size_category enum.
|
||||
--
|
||||
-- 0031_buffer_rules.sql created pet_size_category with values
|
||||
-- ('small', 'medium', 'large', 'xlarge'), but seed.ts and the drizzle
|
||||
-- schema (PetSizeCategory type) both use 'extra_large' — a mismatch that
|
||||
-- caused the UAT seed job to fail with:
|
||||
-- invalid input value for enum pet_size_category: "extra_large"
|
||||
--
|
||||
-- 0035/0036 (GRO-1971) registered 'short'/'medium'/'silky' in coat_type.
|
||||
-- This migration is the pet_size_category counterpart: register
|
||||
-- 'extra_large' so seed.ts can write the value the schema declares.
|
||||
--
|
||||
-- Postgres restriction: ALTER TYPE ADD VALUE cannot run inside a
|
||||
-- transaction block. The drizzle migrate runner does not wrap
|
||||
-- individual statements in an explicit transaction, so this applies
|
||||
-- as a single auto-commit DDL.
|
||||
|
||||
ALTER TYPE "pet_size_category" ADD VALUE IF NOT EXISTS 'extra_large';
|
||||
@@ -253,6 +253,13 @@
|
||||
"when": 1751480000000,
|
||||
"tag": "0036_add_missing_coat_type_values",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 37,
|
||||
"version": "7",
|
||||
"when": 1751500000000,
|
||||
"tag": "0037_add_extra_large_to_pet_size_category",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user