import {Injectable} from '../../di' import {Awaitable} from '../../util' /** * Abstract base-class for one-time migrations. */ @Injectable() export abstract class Migration { /** Set by the Migrations unit on load. */ protected migrationIdentifier!: string /** * Sets the migration identifier. * This is used internally when the Migrations service loads * the migration files to determine the ID from the file-name. * It shouldn't be used externally. * @param name */ public setMigrationIdentifier(name: string): void { this.migrationIdentifier = name } /** * Get the unique identifier of this migration. */ public get identifier(): string { return this.migrationIdentifier } /** * Apply the migration. */ abstract up(): Awaitable /** * Undo the migration. */ abstract down(): Awaitable }