Seed the poll archive from the ETL - #232
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The reseed rebuilt every table except this one.
07-poll-counts.sqlis only the legacycms_poll_countsschema, socms_pollsandcms_poll_optionswere left to the application'sEnsureSchemato 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-etlnow emitspolls.sqlandpoll_options.sql, so this picks them up as09-polls.sqland10-poll-options.sql.Ordering
Polls load before options because the options table's foreign key needs its parent rows. The
DROPs at the head of09go the other way round for the same reason: the foreign key refuses the parent'sDROPwhile 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
EnsureSchemadoes that at startup anyway. An empty archive is a missing dump, not a broken database, andverify()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