Describe the bug
Using the command "npm run migrate --rebuild ", the '--rebuild' arg is not passed to arguments list. The program is kept using ALTER mode.
To Reproduce
In command line, execute "npm run migrate --rebuild "
The utility write "Migrating schemas (alter existing schema)" instead of "Migrating schemas (drop existing schema)"
Expected behavior
The program should take into account the --rebuild flag
Additional context
A dump of args show the --rebuild is not present.
I have upgraded my migrate function with the code below.
However, I'm a new Loppback user, I think i saw it worked several month ago. I must have done something wrong somewhere :) (Note: I'm using npm version 7.6.2) .
export async function migrate(args: string[]) {
console.log('=== Schema migration utility ===');
console.log('Usage: npm run migrate [rebuild]');
const existingSchema = args.includes('rebuild') ? 'drop' : 'alter';
console.log('> Migrating schemas using %s mode', existingSchema.toUpperCase());
console.log(" - Instanciating RESTApp...")
const app = new RESTApp();
console.log(" - Booting RESTApp...")
await app.boot();
console.log(" - Migrating schemas using %s mode...", existingSchema.toUpperCase())
await app.migrateSchema({ existingSchema });
console.log(" - Done. Exiting.")
// Connectors usually keep a pool of opened connections,
// this keeps the process running even after all work is done.
// We need to exit explicitly.
process.exit(0);
}
Describe the bug Using the command "npm run migrate --rebuild ", the '--rebuild' arg is not passed to arguments list. The program is kept using ALTER mode.
To Reproduce In command line, execute "npm run migrate --rebuild " The utility write "Migrating schemas (alter existing schema)" instead of "Migrating schemas (drop existing schema)"
Expected behavior The program should take into account the --rebuild flag
Additional context A dump of args show the --rebuild is not present.
I have upgraded my migrate function with the code below. However, I'm a new Loppback user, I think i saw it worked several month ago. I must have done something wrong somewhere :) (Note: I'm using npm version 7.6.2) .