Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* The command is meant to migrate the database by execute migrations
* in `up` direction.
*/
@inject([null, 'Adonis/Lucid/Database'])
export default class Migrate extends MigrationsBase {
public static commandName = 'migration:rollback'
public static description = 'Rollback migrations to a given batch number'
@flags.string({ description: 'Define a custom database connection' })
public connection: string
@flags.boolean({ description: 'Print SQL queries, instead of running the migrations' })
public dryRun: boolean
@flags.number({
description: 'Define custom batch number for rollback. Use 0 to rollback to initial state',
})
public batch: number
/**
* This command loads the application, since we need the runtime
* to find the migration directories for a given connection
*/
public static settings = {
loadApp: true,
}
constructor (app: ApplicationContract, private _db: DatabaseContract) {
super(app)
}