Created
April 29, 2019 19:26
-
-
Save victor-shelepen/77123d50effc6ea0ef89fc087fcbfa5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@injectable() | |
export class MigrationManagerContainer implements IMigrationManagerContainer { | |
@inject(ContainerType.CurrentVersion) | |
private currentVersionContainer: ICurrentVersionContainer; | |
@multiInject(ContainerType.Migration) | |
private migrations: MigrationContainerBase[]; | |
public getMigrations() { | |
return Promise.resolve(this.migrations.sort((a, b) => { | |
compareVersions(a['version'], b['version']) | |
})); | |
} | |
.... | |
} | |
@migration('0.0.2') | |
class _0_0_2_Migration extends MigrationContainerBase { | |
up() { | |
project.state = 'State->0.0.2' | |
} | |
down() { | |
project.state = 'State->0.0.1' | |
} | |
} | |
@migration('0.0.3') | |
class _0_0_3_Migration extends MigrationContainerBase { | |
up() { | |
project.state = 'State->0.0.3' | |
} | |
down() { | |
project.state = 'State->0.0.2' | |
} | |
} | |
@migration('0.0.1') | |
class _0_0_1_Migration extends MigrationContainerBase { | |
up() { | |
project.state = 'State->0.0.1' | |
} | |
down() { | |
project.state = 'State->0.0.0' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment