feat(supabase): animals and relations M3 with RPCs, history and caps

Species rows (8 + other), animals with the D6b birth model, relations with
composite workspace keys, current/ended/voided states and a partial unique
index; definer RPCs for animals and relations (one lock order, shared write
budget, caps), invoker reads (search_animals, list_client_animals,
client_archive_preview) and search_clients with current_animal_count.
pgTAP 014 (254), parity test, sandbox suite, types from the isolated stack.
This commit is contained in:
bchanot committed 2026-10-26 00:52:22 +01:00
1 parent 2dc04bcfba
commit b54c8e5bd8
8 files changed
+3354 -11

No files matched your search

+14
View File
@@ -16,6 +16,20 @@ export const CLIENT_FIELD_LIMITS = {
city: 80,
} as const
export const ANIMAL_FIELD_LIMITS = {
name: 80,
breed: 80,
speciesDetail: 80,
} as const
/**
* Lower bounds of the SQL CHECKs on birth years and on every record date
* (birth, relation start and end). The upper bound is "not in the future":
* the form checks the device's local date, the RPCs tomorrow's UTC date.
*/
export const BIRTH_YEAR_MIN = 1900
export const RECORD_DATE_MIN = '1900-01-01'
/** U+0000 to U+001F, U+007F to U+009F, U+2028, U+2029 (the SQL literal starts at U+0001: text cannot hold U+0000). */
export const CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F\u2028\u2029]/u