#719·migrate

Migration rolled back

Author: wjch-krlCreated Mar 28, 2022Updated Sep 22, 2026

Describe the Bug When search_path doesn't contain public upon completion of migrations script, migrations fails - but the changes are not rolled back (output below)

Steps to Reproduce Steps to reproduce the behaviour:

  1. Create up script, that would modify the search path - e.g.:
sql
create schema foo;
set search_path to foo;
CREATE TABLE bar(
    baz INTEGER NOT NULL,
    primary key(baz)
);
  1. run migrate up to include ^^
  2. See error

Expected Behavior Migration should be rolled back when any error occurs

Migrate Version v4.15.1 Obtained by running: migrate -version

Loaded Source Drivers file

Loaded Database Drivers postgres

Go Version go version go1.17.6 darwin/arm64

Stacktrace N/A

Additional context

./script/migrate
2022/03/28 09:46:43 Start buffering 5/u test
2022/03/28 09:46:43 Read and execute 5/u test
2022/03/28 09:46:43 error: pq: relation "schema_migrations" does not exist in line 0: TRUNCATE "schema_migrations"
ERROR: 1