AsyncPipe; table schemata; migrations; File logging
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
40
src/orm/template/migration.ts
Normal file
40
src/orm/template/migration.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import {Template} from '../../cli'
|
||||
|
||||
/**
|
||||
* Template for creating new migration classes in app/migrations.
|
||||
*/
|
||||
const templateMigration: Template = {
|
||||
name: 'migration',
|
||||
fileSuffix: '.migration.ts',
|
||||
baseAppPath: ['migrations'],
|
||||
description: 'Create a new class that applies a one-time migration',
|
||||
render: (name: string) => {
|
||||
return `import {Injectable, Migration} from '@extollo/lib'
|
||||
|
||||
/**
|
||||
* ${name}
|
||||
* ----------------------------------
|
||||
* Put some description here.
|
||||
*/
|
||||
@Injectable()
|
||||
export default class ${name} extends Migration {
|
||||
|
||||
/**
|
||||
* Apply the migration.
|
||||
*/
|
||||
async up(): Promise<void> {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo the migration.
|
||||
*/
|
||||
async down(): Promise<void> {
|
||||
|
||||
}
|
||||
}
|
||||
`
|
||||
},
|
||||
}
|
||||
|
||||
export { templateMigration }
|
||||
Reference in New Issue
Block a user