Open
Description
Describe the Bug
Trying to use migrate from inside the code with m.Up() results in the error "no migration" on an empty database.
Steps to Reproduce
Steps to reproduce the behavior:
- My migrations look like:
BEGIN;
create table foo(id integer);
COMMIT;
- I ran migrate with the following options: I created an instance of an
*sql.DB
usingpgx/v5
and gave that instance to the pgx driver of migrate:
driver, err := pgx.WithInstance(sqldb, &pgx.Config{})
m, err := migrate.NewWithDatabaseInstance(
"file://" + MIGRATIONS_DIR,
"postgres", driver)
- See error: "no migration" because there is no migration table. Also if the migration table exists and is empty, same thing happens. If I manually create and fill the table with the current version it works.
Expected Behavior
Migration table should be created and populated automatically as stated in the FAQ.
Migrate Version
v4.18.2
Obtained from go.mod
Loaded Source Drivers
Filesystem/sql
Obtained by running: I wrote sources and the above code
Loaded Database Drivers
pgx
Obtained by running: I wrote the above code
Go Version
e.g. go version go1.23.5 linux/amd64
Obtained by running: go version
Stacktrace
None available
Additional context
None
Metadata
Metadata
Assignees
Labels
No labels