-
Notifications
You must be signed in to change notification settings - Fork 105
Remove redundant pgroll.internal
parameter
#823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
The `pgroll.internal` custom param never worked, because it was set outside of a transaction using `SET LOCAL`, so it had no effect other than spitting out a warning to the Postgres logs. The `pgroll.internal` parameter was meant to be used to ensure that DDL done by `pgroll` operations was not captured as an `inferred` migration. However, the `raw_migration` function also uses the `is_active_migration_period` function for this same purpose, so the `pgroll.internal` parameter was redundant even if it had worked.
kvch
approved these changes
May 12, 2025
andrew-farries
added a commit
that referenced
this pull request
Jun 12, 2025
Set a session-level setting `pgroll.internal` to `TRUE` on connections used by `pgroll` (`pgroll` uses two connections, one to execute migrations and one for its internal state). Use the `pgroll.internal` setting to prevent schema changes made by `pgroll` itself being captured by the raw_migration() event trigger function. DDL changes made in schema `s` are already ignored by `raw_migration()` if there is an active migration period in progress for schema `s`. The change in this commit ensures that *all* DDL changes in *all* schema at *all* times made by `pgroll` are ignored by `raw_migration()`, including version schema creation and the creation of views within those schema. This reverts PR #823 which removed a `pgroll.internal` setting that was set using `SET LOCAL` outside a transaction block. That PR assumeed that setting `pgroll.internal` with `SET LOCAL` outside a transaction had no effect, but it did have an effect (the setting was set to an empty string, which was sufficient given how it was used in`raw_migration()`). This PR uses the same setting but sets it with `SET` (instead of `SET LOCAL`) to make it more obvious what is happening.
andrew-farries
added a commit
that referenced
this pull request
Jun 12, 2025
Set a session-level setting `pgroll.internal` to `TRUE` on connections used by `pgroll` (`pgroll` uses two connections, one to execute migrations and one for its internal state). Use the `pgroll.internal` setting to prevent schema changes made by `pgroll` itself being captured by the raw_migration() event trigger function. DDL changes made in schema `s` are already ignored by `raw_migration()` if there is an active migration period in progress for schema `s`. The change in this commit ensures that *all* DDL changes in *all* schema at *all* times made by `pgroll` are ignored by `raw_migration()`, including version schema creation and the creation of views within those schema. This reverts PR #823 which removed a `pgroll.internal` setting that was set using `SET LOCAL` outside a transaction block. That PR assumeed that setting `pgroll.internal` with `SET LOCAL` outside a transaction had no effect, but it did have an effect (the setting was set to an empty string, which was sufficient given how it was used in`raw_migration()`). This PR uses the same setting but sets it with `SET` (instead of `SET LOCAL`) to make it more obvious what is happening.
andrew-farries
added a commit
that referenced
this pull request
Jun 13, 2025
Set a session-level setting `pgroll.internal` to `TRUE` on connections used by `pgroll` (`pgroll` uses two connections, one to execute migrations and one for its internal state). Use the `pgroll.internal` setting to prevent schema changes made by `pgroll` itself being captured by the `raw_migration()` event trigger function. DDL changes made in schema `s` are already ignored by `raw_migration()` if there is an active migration period in progress for schema `s`. The change in this commit ensures that *all* DDL changes in *all* schema at *all* times made by `pgroll` are ignored by `raw_migration()`, including version schema creation and the creation of views within those schema. This reverts PR #823 which removed a `pgroll.internal` setting that was set using `SET LOCAL` outside a transaction block. That PR assumed that setting `pgroll.internal` with `SET LOCAL` outside a transaction had no effect, but it did have an effect (the setting was set to an empty string, which was sufficient given how it was used in`raw_migration()`). This PR uses the same setting but sets it with `SET` (instead of `SET LOCAL`) to make it more obvious what is happening. Add a test to verify that version schema creation does not create inferred migrations.
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
pgroll.internal
custom parameter never worked, because it was set outside of a transaction usingSET LOCAL
, so it had no effect other than spitting out a warning to the Postgres logs.The
pgroll.internal
parameter was meant to be used to ensure that DDL done bypgroll
operations was not captured as aninferred
migration. However, theraw_migration
function also uses theis_active_migration_period
function for this same purpose, so thepgroll.internal
parameter was redundant even if it had worked.