You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ToApply doesn't consider IgnoreUnknown flags when apply migrations up dir #240
Imagine a project with its migrations, and it has its command to apply it. Now, you have installed library foo that applies migrations also with its CLI (knowing that the library has the flag IgnoreUnknown set to true when applying its migrations).
Problem
If you apply the project migrations and then try to run the migrations for the library, sql-migrate will consider that all migrations from the library were already applied since it does not consider the IgnoreUnknown flag when getting the record that contains the last applied migration:
It's possible to use the migrate.SetTable to change the migrations table name for the library or the project. But, I'd recommend using the migrate.MigrationSet{TableName: "my_library_migrations"} struct locally to avoid changing the singleton of the library because it's error-prone.
// sql-migrate version 1.3.1ms:= migrate.MigrationSet{TableName: "my_library_migrations"}
m:= migrate.HttpFileSystemMigrationSource{FileSystem: http.FS(migrations.FS)}
ms.ExecMax(db, "postgres", m, migrate.Up, 1)
Activity
CaioTeixeira95 commentedon Mar 7, 2023
It's possible to use the
migrate.SetTableto change the migrations table name for the library or the project. But, I'd recommend using themigrate.MigrationSet{TableName: "my_library_migrations"}struct locally to avoid changing the singleton of the library because it's error-prone.