Skip to content

Commit c3c73e4

Browse files
Rename pgroll.internal GUC to pgroll.no_inferred_migrations (#932)
Rename the GUC that causes `pgroll` to ignore schema changes made by itself (ie don't create `inferred` migrations for them). The new name better reflects its purpose, and allows us to document it externally as a way for other applications to have their own DDL ignored by `pgroll`.
1 parent d7f2f61 commit c3c73e4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pkg/roll/roll.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ func setupConn(ctx context.Context, pgURL, schema string, options options) (*sql
101101
return nil, err
102102
}
103103

104-
_, err = conn.ExecContext(ctx, "SET pgroll.internal TO 'TRUE'")
104+
_, err = conn.ExecContext(ctx, "SET pgroll.no_inferred_migrations TO 'TRUE'")
105105
if err != nil {
106-
return nil, fmt.Errorf("unable to set pgroll.internal to true: %w", err)
106+
return nil, fmt.Errorf("unable to set pgroll.no_inferred_migrations to true: %w", err)
107107
}
108108

109109
if options.lockTimeoutMs > 0 {

pkg/state/init.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ DECLARE
370370
migration_id text;
371371
BEGIN
372372
-- Ignore schema changes made by pgroll
373-
IF (pg_catalog.current_setting('pgroll.internal', TRUE) = 'TRUE') THEN
373+
IF (pg_catalog.current_setting('pgroll.no_inferred_migrations', TRUE) = 'TRUE') THEN
374374
RETURN;
375375
END IF;
376376
IF tg_event = 'sql_drop' AND tg_tag = 'DROP SCHEMA' THEN

pkg/state/state.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ func New(ctx context.Context, pgURL, stateSchema string, opts ...StateOpt) (*Sta
4747
return nil, err
4848
}
4949

50-
_, err = conn.ExecContext(ctx, "SET pgroll.internal TO 'TRUE'")
50+
_, err = conn.ExecContext(ctx, "SET pgroll.no_inferred_migrations TO 'TRUE'")
5151
if err != nil {
52-
return nil, fmt.Errorf("unable to set pgroll.internal to true: %w", err)
52+
return nil, fmt.Errorf("unable to set pgroll.no_inferred_migrations to true: %w", err)
5353
}
5454

5555
st := &State{

0 commit comments

Comments
 (0)