@palmares/databases
Version:
Add support for working with databases with palmares framework
36 lines • 1.79 kB
TypeScript
import type { DatabaseAdapter } from '../../engine';
import type { Operation } from '../actions';
import type { FoundMigrationsFileType } from '../types';
export declare class Migration {
#private;
domainName: string;
databaseName: string;
name: string;
dependsOn: string;
engineInstance: DatabaseAdapter;
operations: Operation[];
allMigrations: FoundMigrationsFileType[];
transaction: any;
private constructor();
/**
* The method that is used to effectively run the migration. By default we will run the migration
* files in a transaction, so we guarantee that if the migration fails for some reason all of the
* actions and changes will be rolled back.
*/
private run;
/**
* The static method that is used to build the migration from the file. We load the file data into memory
* and then build the migration from that data.
*
* For running the migration we do need the engine instance that is being used to run this migration, the file
* to build the migration from, and all of the migrations that is available for this engine instance. We need
* them to be able to recreate the state.
*
* @param engineInstance - The engine instance that is being used to run all of the migrations in the database.
* @param migrationFile - The current migration file that is running.
* @param allMigrations - All of the migration files that are available to be used inside of this database. With
* this we are able to recreate the state of the database.
*/
static buildFromFile(engineInstance: DatabaseAdapter, migrationFile: FoundMigrationsFileType, allMigrations: FoundMigrationsFileType[]): Promise<(() => Promise<void>)[]>;
}
//# sourceMappingURL=migration.d.ts.map