Repository navigation
[Mocha] Support out-of-band PostgreSQL schema migrations - #10486
Merged
Merged
Conversation
tobias-tengler
force-pushed
the
tte/postgres-transport-migrations
branch
from
October 6, 2026 07:35
eb9d0bb to
1cfa319
Compare
Contributor
Patch coverage93.0% of changed lines covered (185/199)
Uncovered changed lines (JSON){
"sha": "300213df86fcbceec9727083dfb58be72e15dc9d",
"files": [
{ "path": "src/Mocha/src/Mocha.Transport.Postgres/Descriptors/PostgresQueueDescriptor.cs", "ranges": [[128, 128]] },
{ "path": "src/Mocha/src/Mocha.Transport.Postgres/ThrowHelper.cs", "ranges": [[6, 6], [9, 9]] },
{ "path": "src/Mocha/src/Mocha.Transport.Postgres/PostgresTransportSchema.cs", "ranges": [[26, 27], [31, 32], [41, 43]] },
{ "path": "src/Mocha/src/Mocha.Transport.Postgres/Connection/PostgresSchemaSql.cs", "ranges": [[39, 42]] }
]
}Project coverage: 58.5% (313828/536115 lines) |
Add explicit transport schema migration, offline SQL export, and an AutoMigrate switch that skips schema work when disabled. Preserve existing topology provisioning and migration history compatibility. Cover restricted runtime users, migration concurrency and rollback, SQL artifact execution, and EF outbox persistence with fresh and template databases. Document setup and export commands.
tobias-tengler
force-pushed
the
tte/postgres-transport-migrations
branch
from
October 6, 2026 13:54
3216cb5 to
c259daa
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The transactional database migration and restricted-permission behavior warrant final human validation against supported PostgreSQL environments.
Review effort: Balanced
Findings: None
What changed in this PR
Adds explicit PostgreSQL schema migration APIs so restricted runtime users can start the transport without schema permissions.
Changes:
- Adds runtime and offline SQL migration APIs with transaction and advisory-lock protection.
- Adds
AutoMigrateconfiguration while preserving topology provisioning. - Adds migration, compatibility, rollback, and restricted-user tests and documentation.
| File | Description |
|---|---|
website/content/docs/mocha/transports/postgres.md |
Documents startup migration and manual setup. |
src/Mocha/test/Mocha.Transport.Postgres.Tests/Connection/PostgresTransportSchemaTests.cs |
Tests migration APIs and restricted users. |
src/Mocha/test/Mocha.Transport.Postgres.Tests/Behaviors/AutoProvisionIntegrationTests.cs |
Uses the public migration API. |
src/Mocha/src/Mocha.Transport.Postgres/ThrowHelper.cs |
Centralizes migration exceptions. |
src/Mocha/src/Mocha.Transport.Postgres/PostgresTransportSchema.cs |
Exposes migration and SQL-generation APIs. |
src/Mocha/src/Mocha.Transport.Postgres/PostgresMessagingTransport.cs |
Honors AutoMigrate during startup. |
src/Mocha/src/Mocha.Transport.Postgres/Descriptors/PostgresQueueDescriptor.cs |
Qualifies the shared throw helper. |
src/Mocha/src/Mocha.Transport.Postgres/Descriptors/PostgresMessagingTransportDescriptor.cs |
Implements AutoMigrate configuration. |
src/Mocha/src/Mocha.Transport.Postgres/Descriptors/IPostgresMessagingTransportDescriptor.cs |
Adds the public descriptor contract. |
src/Mocha/src/Mocha.Transport.Postgres/Connection/PostgresSchemaSql.Migrations.cs |
Defines migration DDL. |
src/Mocha/src/Mocha.Transport.Postgres/Connection/PostgresSchemaSql.cs |
Generates guarded migration SQL. |
src/Mocha/src/Mocha.Transport.Postgres/Connection/PostgresSchemaMigrator.cs |
Removes the superseded migrator. |
src/Mocha/src/Mocha.Transport.Postgres/Connection/PostgresConnectionManager.cs |
Delegates to the public schema API. |
src/Mocha/src/Mocha.Transport.Postgres/Configurations/PostgresTransportConfiguration.cs |
Adds the migration setting and default. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
PascalSenn
approved these changes
Oct 6, 2026
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.
Add explicit transport schema migration, offline SQL export, and an AutoMigrate switch that skips schema work when disabled. Preserve existing topology provisioning and migration history compatibility.