I am using SQL files to update a PostgreSql database. I wanted to run 3 scopes "up" in sequence and then the root "up". The scopes are to run in a base schema (scoped), run in some seed data (scoped), and then run in all the deltas since the base schema (in root).
If I use the programmable API then all the scoped "up"s run as expected, but the root "up" gives "No migrations to run" message on the console and is not added to the migrations table in the database.
If I run db-migrate up from the CLI, the root "up" and "down" both work as expected and an entry appears in the migrations table.
So I think there may be a bug in the programmable API, since it seems to work as expected from the CLI. Or I am not specifying this correctly :-)
Expected behaviour
If I call either "up" or "down" without a scope using the programmable API, then I would expect the root files to run - even if I had previously specified an "up" or "down" with a scope.
Minimal reproduction of the problem with instructions
dbmigrate.reset() //roll back root "No migrations found"
.then(() => dbmigrate.reset('scope2')) //works - migrations table updated
.then(() => dbmigrate.reset('scope1')) //works - migrations table updated
.then(() => dbmigrate.up(undefined, 'scope1')) //works - migrations table updated
.then(() => dbmigrate.up(undefined, 'scope2')) //works - migrations table updated
.then(() => dbmigrate.up()) // doesn't work "No migrations found". Works from CLI
.then(() => {
//Do some other stuff -works
return Promise.resolve();
});
What is the motivation / use case for changing the behaviour?
Programmable API behaviour should match CLI or documentation should be updated to state that once you start using scopes then EVERYTHING has to have a scope.
Environment
"db-migrate": "^0.11.6",
"db-migrate-pg": "^1.0.0",
Additional information:
- Node version: XX
- Platform:
Others:
Running on local development environment at the moment but trying to work out method that will work for deployments to new environments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm submitting a...
Current behavior
I am using SQL files to update a PostgreSql database. I wanted to run 3 scopes "up" in sequence and then the root "up". The scopes are to run in a base schema (scoped), run in some seed data (scoped), and then run in all the deltas since the base schema (in root).
If I use the programmable API then all the scoped "up"s run as expected, but the root "up" gives "No migrations to run" message on the console and is not added to the migrations table in the database.
If I run db-migrate up from the CLI, the root "up" and "down" both work as expected and an entry appears in the migrations table.
So I think there may be a bug in the programmable API, since it seems to work as expected from the CLI. Or I am not specifying this correctly :-)
Expected behaviour
If I call either "up" or "down" without a scope using the programmable API, then I would expect the root files to run - even if I had previously specified an "up" or "down" with a scope.
Minimal reproduction of the problem with instructions
dbmigrate.reset() //roll back root "No migrations found" .then(() => dbmigrate.reset('scope2')) //works - migrations table updated .then(() => dbmigrate.reset('scope1')) //works - migrations table updated .then(() => dbmigrate.up(undefined, 'scope1')) //works - migrations table updated .then(() => dbmigrate.up(undefined, 'scope2')) //works - migrations table updated .then(() => dbmigrate.up()) // doesn't work "No migrations found". Works from CLI .then(() => { //Do some other stuff -works return Promise.resolve(); });
What is the motivation / use case for changing the behaviour?
Programmable API behaviour should match CLI or documentation should be updated to state that once you start using scopes then EVERYTHING has to have a scope.
Environment