You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d46614e
Browse filesBrowse the repository at this point in the historyBrowse files
refactor: reduce cognitive complexity in DBSchema and PostgresAdapter (S3776)
DBSchema::getDiff (19 -> ~10)
Extract the two blocks added for #165 into their own methods:
selectTablesNeedingDiff() for the pre-scan partition and bulkFetchSchemas()
for the batched load. getDiff() reads as a sequence of phases again, and
each helper is well under the limit on its own.
PostgresAdapter::assembleConstraints (18 -> ~12)
This class sits on the 20-method ceiling (S2166), so the complexity had to
come out in place rather than into a helper. Both nested loop pairs are
flattened:
- FK/UNIQUE/PK rows group under one table+constraint key joined by NUL,
which no Postgres identifier can contain, so the emit loop is single-level
and rebuilds the map from each row's own table_name/constraint_name.
- Named NOT NULL constraints are collected as a flat list instead of a
[table][name] map. Each row already carries both names, and the query
yields exactly one row per constraint, so nothing needed the nesting.
Output is unchanged: assembled constraints still come out grouped by table
in the order the ORDER BY produces. Adds a test that named NOT NULL
constraints sharing a name across tables stay scoped to their own table,
matching the existing coverage for the other constraint kinds.
0 commit comments