|
|
|
@ -9,7 +9,7 @@ const templateMigration: Template = {
|
|
|
|
|
baseAppPath: ['migrations'],
|
|
|
|
|
description: 'Create a new class that applies a one-time migration',
|
|
|
|
|
render: (name: string) => {
|
|
|
|
|
return `import {Injectable, Migration} from '@extollo/lib'
|
|
|
|
|
return `import {Injectable, Migration, Inject, DatabaseService} from '@extollo/lib'
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ${name}
|
|
|
|
@ -18,11 +18,14 @@ const templateMigration: Template = {
|
|
|
|
|
*/
|
|
|
|
|
@Injectable()
|
|
|
|
|
export default class ${name} extends Migration {
|
|
|
|
|
@Inject()
|
|
|
|
|
protected readonly db!: DatabaseService
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Apply the migration.
|
|
|
|
|
*/
|
|
|
|
|
async up(): Promise<void> {
|
|
|
|
|
const schema = this.db.get().schema()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -30,6 +33,7 @@ export default class ${name} extends Migration {
|
|
|
|
|
* Undo the migration.
|
|
|
|
|
*/
|
|
|
|
|
async down(): Promise<void> {
|
|
|
|
|
const schema = this.db.get().schema()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|