docs(bootstrap): document prefixed FK table name override pattern
Adds a note to the Field Evolution Checklist explaining why poc_person_id and similar prefixed FK fields need an explicit mapping in sanitize_payload(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -252,6 +252,15 @@ When a table or view gains, loses, or renames fields — **do all of these in or
|
|||||||
5. Run the relevant schema/search E2E tests
|
5. Run the relevant schema/search E2E tests
|
||||||
6. **Restart Docker:** `docker compose restart ae_api`
|
6. **Restart Docker:** `docker compose restart ae_api`
|
||||||
|
|
||||||
|
#### FK fields with non-matching prefixes
|
||||||
|
|
||||||
|
The generic `sanitize_payload()` in `lib_api_crud_v3.py` derives the lookup table name by stripping `_id` from the field name (`event_location_id` → `event_location` ✓). If a field has a prefix that doesn't match the table (`poc_person_id` → would look up `poc_person`, but the table is `person`), the random string reaches the DB as-is and MariaDB throws a 1366 integer error.
|
||||||
|
|
||||||
|
Fix: add a mapping to the special-case block in `sanitize_payload()` (same file, same block as `address_location → address`):
|
||||||
|
```python
|
||||||
|
if obj_type_lookup == 'poc_person': obj_type_lookup = 'person'
|
||||||
|
```
|
||||||
|
|
||||||
#### Alt-view fields (in `tbl_alt` only)
|
#### Alt-view fields (in `tbl_alt` only)
|
||||||
Some objects have a richer alternate SQL view triggered by `?view=alt`. These fields
|
Some objects have a richer alternate SQL view triggered by `?view=alt`. These fields
|
||||||
**must still be declared in the Pydantic model and `searchable_fields`** even if they only
|
**must still be declared in the Pydantic model and `searchable_fields`** even if they only
|
||||||
|
|||||||
Reference in New Issue
Block a user