Skip to content

v0.1.1-alpha: Fix stale schema cache causing tables to be invisible across migrations

Latest

Choose a tag to compare

@simon-mundy simon-mundy released this 19 Mar 22:30
· 14 commits to main since this release
The metadata source caches table/column lists internally with no public
API to clear them. clearCache() was reusing the same injected metadata
instance, so tables created in earlier migrations were invisible to
later ones. Additionally, ensureTable() did not update the inspector
cache after creating a table, so ensureForeignKey/ensureColumn calls
within the same migration could not see the newly created table.

- clearCache(): create a fresh metadata instance instead of reusing
  the injected one (falls back to injected in test environments)
- ensureTable(): call markTableCreated() after successful DDL execution
- Add SchemaInspector::markTableCreated() for within-migration updates

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>