feat: expose MIGRATION_TABLE constant on PactBroker::DB#906
Draft
feat: expose MIGRATION_TABLE constant on PactBroker::DB#906
Conversation
Adds an explicit MIGRATION_TABLE constant (:schema_migrations) to PactBroker::DB so that consumers running pact_broker alongside their own migrations can reference the default tracking table by name and supply a different table: option to keep migration state isolated. The existing run_migrations/is_current?/check_current methods already forward the options hash to Sequel::TimestampMigrator, so no behaviour change — this is purely a public API clarification. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…n tables - Version.call prefers :pact_broker_schema_migrations when present, falls back to :schema_migrations then :schema_info — supports both the new split-table setup and existing single-table deployments - TableDependencyCalculator excludes :pact_broker_schema_migrations and :pactflow_schema_migrations alongside the existing exclusions so migration tracking tables are never returned as truncatable tables Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extracts tracking_tables into a named variable in TableDependencyCalculator and ensures both pact_broker_schema_migrations and pactflow_schema_migrations are excluded from ordered_tables (truncation) and explicitly dropped in drop_tables alongside the legacy schema_migrations table. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
PactBroker::DB::MIGRATION_TABLE = :schema_migrationsas an explicit public constantrun_migrations,is_current?, andcheck_currentall accept atable:option for a custom tracking tablescript/test_migration_table_constant.rb) demonstrating migration with a custom table against postgresMotivation
When consumers run pact_broker alongside their own proprietary migrations they need to keep migration state isolated. The existing code already forwards the
optionshash toSequel::TimestampMigratorso customtable:works — this PR makes that API explicit and discoverable via the constant.Test plan
DATABASE_URL=postgres://... BUNDLE_WITH=pg bundle exec ruby script/test_migration_table_constant.rb— should print=== PASS ===🤖 Generated with Claude Code