Skip to content

Commit 2982cf7

Browse files
Remove redundant pgroll.internal parameter (#823)
The `pgroll.internal` custom parameter 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.
1 parent a8ab934 commit 2982cf7

File tree

3 files changed

+0
-14
lines changed

3 files changed

+0
-14
lines changed

pkg/roll/roll.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ func setupConn(ctx context.Context, pgURL, schema string, options options) (*sql
102102
return nil, err
103103
}
104104

105-
_, err = conn.ExecContext(ctx, "SET LOCAL pgroll.internal to 'TRUE'")
106-
if err != nil {
107-
return nil, fmt.Errorf("unable to set pgroll.internal to true: %w", err)
108-
}
109-
110105
if options.lockTimeoutMs > 0 {
111106
_, err = conn.ExecContext(ctx, fmt.Sprintf("SET lock_timeout to '%dms'", options.lockTimeoutMs))
112107
if err != nil {

pkg/state/init.sql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,6 @@ DECLARE
317317
schemaname text;
318318
migration_id text;
319319
BEGIN
320-
-- Ignore migrations done by pgroll
321-
IF (pg_catalog.current_setting('pgroll.internal', 'TRUE') <> 'TRUE') THEN
322-
RETURN;
323-
END IF;
324320
IF tg_event = 'sql_drop' AND tg_tag = 'DROP SCHEMA' THEN
325321
-- Take the schema name from the drop schema command
326322
SELECT

pkg/state/state.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ func New(ctx context.Context, pgURL, stateSchema string) (*State, error) {
4646
return nil, err
4747
}
4848

49-
_, err = conn.ExecContext(ctx, "SET LOCAL pgroll.internal to 'TRUE'")
50-
if err != nil {
51-
return nil, fmt.Errorf("unable to set pgroll.internal to true: %w", err)
52-
}
53-
5449
return &State{
5550
pgConn: conn,
5651
schema: stateSchema,

0 commit comments

Comments
 (0)