From 7f471d653de8b77f8128bb1319399d721dd046c6 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Tue, 4 Jan 2022 21:37:43 +0000 Subject: [PATCH] attempt to placae test Signed-off-by: Andrew Thornton --- engine.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engine.go b/engine.go index 3eefdfa6..430e82b8 100644 --- a/engine.go +++ b/engine.go @@ -471,6 +471,9 @@ func (engine *Engine) dumpTables(ctx context.Context, tables []*schemas.Table, w DBName: uri.DBName, // DO NOT SET SCHEMA HERE } + if dstDialect.URI().DBType == schemas.POSTGRES { + destURI.Schema = engine.dialect.URI().Schema + } if err := dstDialect.Init(&destURI); err != nil { return err } @@ -489,10 +492,6 @@ func (engine *Engine) dumpTables(ctx context.Context, tables []*schemas.Table, w if _, err := io.WriteString(w, "SET sql_mode='NO_BACKSLASH_ESCAPES';\n"); err != nil { return err } - } else if dstDialect.URI().DBType == schemas.POSTGRES && engine.dialect.URI().Schema != "" { - if _, err := fmt.Fprintf(w, `SELECT set_config('search_path', '%s,' || current_setting('search_path'), false);`+"\n", strings.ReplaceAll(engine.dialect.URI().Schema, "'", "''")); err != nil { - return err - } } for i, table := range tables {