Skip to content

Plan a catalog for the default database together with one for every database, under its registered name - #597

Merged
jasperblues merged 3 commits into
mainfrom
default-target-595
Nov 26, 2026
Merged

jasperblues merged 3 commits into
mainfrom
default-target-595

Conversation

@jasperblues

Copy link
Copy Markdown
Member

Closes #595

A catalog for the default database (for_default_database()) and a catalog for every database were planned separately, even when they targeted the same database. Each plan saw the other's items as orphans of their owner, so every enforce() logged false "no longer declares" warnings. The owner's recorded inventory then held only one half.

Each database a catalog names is now resolved to the name it is registered under, as drivine4j does (drivine4j#854). That covers default too, and so do the databases that runtime items are kept by. Each database is then planned once, with all of its owner's items:

  • SchemaManager._targets resolves each named database and removes duplicates, so naming both default and the database itself targets it once.
  • ensure_catalog and remove_catalog keep and drop runtime items by the registered name, so items ensured for default can be removed by a catalog that names the database, and the other way round.
  • The unindexed-@NodeId check no longer maps names itself, since the resolved targets already carry the registered name.

Tests (tests/unit/test_schema_default_target.py, SQLite, async and sync):

  • A default catalog and an every-database catalog give one plan under the registered name. A second enforce finds everything already matching and logs no orphan warnings. The inventory records both items.
  • Items ensured at runtime for default are applied with the catalog's items and removed by the database's name.
  • With two databases, default is the first one registered and only that one.
  • A catalog that names both default and the database targets it once.
  • tests/unit/test_node_id_index_check.py: a catalog ensured for default is catalogued and listed on the database by its registered name.

Whole suite with Oracle (ORACLE_TESTS=true) on the final commit:

  • tests/integration: 4710 passed, 291 skipped, 7 xfailed, 1 xpassed, 0 failed
  • tests/sync_integration: 4640 passed, 290 skipped, 7 xfailed, 1 xpassed, 0 failed

Review: 3 passes, last CLEAN.

  • Pass 1 added the test for a catalog naming both default and the database, and removed name mappings the resolved targets made no-ops.
  • Pass 2 added the @NodeId check test for a catalog ensured for default, and fixed a docstring.
  • Pass 3 was CLEAN.

…atabase, under the database's registered name (#595)

A catalog naming 'default' was planned apart from one for every database on the same database, so each warned the
other's items were orphans of their owner, and the owner's inventory recorded one half or the other. Each named target,
and the databases runtime items are kept by, is now resolved to its registered name, as drivine4j's SchemaTargets
resolves it (drivine4j#854).
…e, and drop the NodeId check's name mapping the resolved targets make a no-op (#595)
…atabase by its name, and say the default and every-database catalogs are planned together (#595)
@jasperblues
jasperblues merged commit 3201fc4 into main Nov 26, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A catalog for the default database and one for every database are planned apart on the same database, each warning the other's items are orphans

1 participant