Plugin baselines skip tables that already exist

This commit is contained in:
2026-08-24 09:28:52 -04:00
parent ce3a0f4338
commit f109dd1349
12 changed files with 285 additions and 74 deletions

View File

@@ -105,6 +105,20 @@ ADR-007 and ADR-002.
the wrong code. The page index now travels with the page.
- The back label's dotted preview outline outspecified the print reset and drew
a dashed rule down the edge of every second card.
- **`flask plugin upgrade-all` failed a plugin whose tables already existed**
("table securesendsecrets already exists" on the tools plugin). Every
post-cutover baseline emitted a plain `op.create_table`, which is correct only
while a table's existence and its plugin's Alembic stamp cannot disagree.
They can: anything that builds tables from the models stamps nothing, and a
run that creates a table then fails before its stamp commits leaves the same
split, where re-running is the obvious response. Creates and indexes across
all nine table-creating plugin migrations now skip what is already there.
Indexes are matched on their COLUMNS rather than their name, because
`db.create_all()` names them by SQLAlchemy's convention and a migration by
this repo's, so a name-keyed check would silently add a duplicate index
instead of skipping. Note the remaining limit: this makes a baseline
idempotent, not a whole chain. A longer chain can still meet an `ALTER` whose
column is already present, which no guard on `create_table` addresses.
- **Saving a machine that has a controlling PC answered "this relationship
already exists" and refused the save.** Reported against a map position
change, but the map was incidental: the form re-POSTed the controlling-PC