@nodeboot/starter-persistence
Version:
Nodeboot starter package for persistence. Supports data access layer auto-configuration providing features like database initialization, consistency check, entity mapping, repository pattern, transactions, paging, migrations, persistence listeners, persis
34 lines • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Migration = Migration;
const PersistenceContext_1 = require("../PersistenceContext");
/**
* Decorator to register a class as a database migration within the persistence context.
*
* Use this decorator on classes implementing TypeORM's MigrationInterface to
* include them in the migration lifecycle of the application.
*
* @template T - A class type extending MigrationInterface.
* @returns {ClassDecorator} The class decorator function.
*
* @example
* ```ts
* @Migration()
* class AddUsersTable1616161616161 implements MigrationInterface {
* async up(queryRunner: QueryRunner): Promise<void> {
* // migration logic here
* }
* async down(queryRunner: QueryRunner): Promise<void> {
* // rollback logic here
* }
* }
* ```
*
* @author Manuel Santos <https://github.com/manusant>
*/
function Migration() {
return (target) => {
PersistenceContext_1.PersistenceContext.get().migrations.push(target);
};
}
//# sourceMappingURL=Migration.js.map