mix geo_genius.sweep_staging (geo_genius v0.2.0)

Copy Markdown View Source

Drops per-run staging tables left behind by runs that have already finished.

Options

  • --yes - actually drop the tables
  • --repo - the Ecto Repo to run against
  • --prefix - the PostgreSQL schema GeoGenius is installed in

The pipeline drops a run's staging table in an after clause, and that drop is deliberately rescued so a database failure during cleanup cannot destroy the run's own failure record. A host whose database dies mid-cleanup therefore leaks a table, nothing else reclaims it, and the schema down migration's teardown refuses to drop a non-empty schema -- so a leak eventually blocks an uninstall. This reclaims them.

A table whose import_run row is gone entirely is reclaimed too. That is the case nothing else can reach: with no run row to read a status from, such a table is invisible to anything that starts from import_run, and it would otherwise sit in the schema until an operator found it by hand.

Like mix geo_genius.rollback, it prints what it would drop and does nothing without --yes.