Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f262c19561 | |||
| b15a53a19b | |||
| 1faa7945c6 |
@@ -0,0 +1,19 @@
|
|||||||
|
-- Migration: 0037_add_extra_large_to_pet_size_category.sql
|
||||||
|
-- GRO-1979: 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,
|
"when": 1751480000000,
|
||||||
"tag": "0036_add_missing_coat_type_values",
|
"tag": "0036_add_missing_coat_type_values",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 37,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1751500000000,
|
||||||
|
"tag": "0037_add_extra_large_to_pet_size_category",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+20
-14
@@ -1106,14 +1106,17 @@ async function seed() {
|
|||||||
temperamentScore: randInt(1, 5),
|
temperamentScore: randInt(1, 5),
|
||||||
temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)),
|
temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)),
|
||||||
medicalAlerts: (() => {
|
medicalAlerts: (() => {
|
||||||
// ~30% of pets get alerts; TestCooper/TestRocky get deterministic types
|
// TestCooper always has a behavioral alert; TestRocky always has a skin alert.
|
||||||
|
// All other UAT test pets follow the 30% random distribution.
|
||||||
|
// Deterministic alerts on 2 of 507 pets (~0.4%) do not meaningfully shift
|
||||||
|
// the overall distribution from the 25-35% target band.
|
||||||
|
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() }));
|
||||||
|
}
|
||||||
if (rand() < 0.3) {
|
if (rand() < 0.3) {
|
||||||
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() }));
|
|
||||||
}
|
|
||||||
const count = rand() < 0.7 ? 1 : 2;
|
const count = rand() < 0.7 ? 1 : 2;
|
||||||
return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() }));
|
return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() }));
|
||||||
}
|
}
|
||||||
@@ -1136,14 +1139,17 @@ async function seed() {
|
|||||||
temperamentScore: randInt(1, 5),
|
temperamentScore: randInt(1, 5),
|
||||||
temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)),
|
temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)),
|
||||||
medicalAlerts: (() => {
|
medicalAlerts: (() => {
|
||||||
// ~30% of pets get alerts; TestCooper/TestRocky get deterministic types
|
// TestCooper always has a behavioral alert; TestRocky always has a skin alert.
|
||||||
|
// All other UAT test pets follow the 30% random distribution.
|
||||||
|
// Deterministic alerts on 2 of 507 pets (~0.4%) do not meaningfully shift
|
||||||
|
// the overall distribution from the 25-35% target band.
|
||||||
|
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() }));
|
||||||
|
}
|
||||||
if (rand() < 0.3) {
|
if (rand() < 0.3) {
|
||||||
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() }));
|
|
||||||
}
|
|
||||||
const count = rand() < 0.7 ? 1 : 2;
|
const count = rand() < 0.7 ? 1 : 2;
|
||||||
return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() }));
|
return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() }));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user