Skip to content

Seed the poll archive from the ETL - #232

Merged
ssavutu merged 1 commit into
mainfrom
feat/seed-poll-archive
Sep 4, 2026
Merged

Seed the poll archive from the ETL#232
ssavutu merged 1 commit into
mainfrom
feat/seed-poll-archive

Conversation

@ssavutu

@ssavutu ssavutu commented Sep 4, 2026

Copy link
Copy Markdown
Member

The reseed rebuilt every table except this one. 07-poll-counts.sql is only the legacy cms_poll_counts schema, so cms_polls and cms_poll_options were left to the application's EnsureSchema to create empty — meaning the 177 polls just imported from the legacy site, and their 9,442 recorded votes, would vanish on the next reseed with nothing to restore them from. The photo gallery has the same shape of bug.

wordpress-etl now emits polls.sql and poll_options.sql, so this picks them up as 09-polls.sql and 10-poll-options.sql.

Ordering

Polls load before options because the options table's foreign key needs its parent rows. The DROPs at the head of 09 go the other way round for the same reason: the foreign key refuses the parent's DROP while the child still exists.

When the artifacts are missing

Taking one file without the other is worse than taking neither — options alone fail the foreign key, polls alone seed an archive of unanswerable questions — so a half-present pair is skipped with a warning. When neither is there the seed files are left empty rather than creating the tables, since EnsureSchema does that at startup anyway. An empty archive is a missing dump, not a broken database, and verify() now says so.

Testing

Ran the generator against the ETL's real output (177 polls / 572 options) and exercised all three paths: full pair seeds, half pair skips with a warning, neither leaves an explanatory placeholder.

Depends on

DrexelTriangle/wordpress-etl#<poll-archive> — without it a reseed writes empty seed files and warns. Nothing breaks if they land apart; the archive just stays empty until both are in.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q11ahEMb1HbNDmkd7gwRpr

The reseed rebuilt every table except this one. 07-poll-counts.sql is only the
legacy cms_poll_counts schema, so cms_polls and cms_poll_options were left to
the application's EnsureSchema to create empty -- meaning the 177 imported
polls, and their 9,442 recorded votes, would vanish on the next reseed with
nothing to restore them from. The photo gallery has the same shape of bug.

wordpress-etl now emits polls.sql and poll_options.sql, so pick them up as
09 and 10. Polls load before options because the options table's foreign key
needs its parent rows, and the drops at the head of 09 go the other way round
for the same reason: the foreign key refuses the parent's DROP while the child
still exists.

Taking one file without the other is worse than taking neither -- options alone
fail the foreign key, polls alone seed an archive of unanswerable questions --
so a half-present pair is skipped with a warning. When neither is there the
seed files are left empty rather than creating the tables, since EnsureSchema
does that at startup anyway; an empty archive is a missing dump, not a broken
database, and verify() now says so.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q11ahEMb1HbNDmkd7gwRpr
@ssavutu
ssavutu merged commit 688b45f into main Sep 4, 2026
7 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.

1 participant