Skip to content

Commit b341e64

Browse files
committed
revert: remove search_path modification approach
1 parent 662b181 commit b341e64

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

pkg/migration/apply.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ func ApplyMigrations(ctx context.Context, pending []string, conn *pgx.Conn, fsys
6767
if _, err := conn.Exec(ctx, "RESET ALL"); err != nil {
6868
return errors.Errorf("failed to reset connection state: %v", err)
6969
}
70-
// Ensure extensions schema is in search_path so extension types (e.g., ltree) are accessible
71-
if _, err := conn.Exec(ctx, `SET search_path = "$user", public, extensions`); err != nil {
72-
return errors.Errorf("failed to set search_path: %v", err)
73-
}
7470
if migration, err := NewMigrationFromFile(path, fsys); err != nil {
7571
return err
7672
} else if err := migration.ExecBatch(ctx, conn); err != nil {

pkg/migration/apply_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ func TestApplyMigrations(t *testing.T) {
110110
mockMigrationHistory(conn).
111111
Query("RESET ALL").
112112
Reply("RESET").
113-
Query(`SET search_path = "$user", public, extensions`).
114-
Reply("SET").
115113
Query(testSchema).
116114
Reply("CREATE SCHEMA").
117115
Query(INSERT_MIGRATION_VERSION, "0", "schema", []string{testSchema}).
@@ -149,9 +147,7 @@ func TestApplyMigrations(t *testing.T) {
149147
defer conn.Close(t)
150148
mockMigrationHistory(conn).
151149
Query("RESET ALL").
152-
Reply("RESET").
153-
Query(`SET search_path = "$user", public, extensions`).
154-
Reply("SET")
150+
Reply("RESET")
155151
// Run test
156152
err := ApplyMigrations(context.Background(), pending, conn.MockClient(t), fsys)
157153
// Check error
@@ -165,8 +161,6 @@ func TestApplyMigrations(t *testing.T) {
165161
mockMigrationHistory(conn).
166162
Query("RESET ALL").
167163
Reply("RESET").
168-
Query(`SET search_path = "$user", public, extensions`).
169-
Reply("SET").
170164
Query(testSchema).
171165
ReplyError(pgerrcode.UndefinedTable, `relation "supabase_migrations.schema_migrations" does not exist`).
172166
Query(INSERT_MIGRATION_VERSION, "0", "schema", []string{testSchema}).

0 commit comments

Comments
 (0)