Universal Migration Engine (UME) is a flexible migration framework that can plug into any new or existing project, and be compatible with any framework, whether it be SQL no-SQL or something else.
How It Works
UME does not make any assumptions about how to perform a migration, rather when to perform a migration. UME can recognize the current state of the application and apply the appropriate migrations. Migrations are completely customizable to fit your need. UME provides the framework for recognizing application state, executing one time migrations, and backing-up/rolling-back as needed.
Thus, with UME, you can continuously update your schema and just provide a migration function to UME and UME will determine when migration needs to be run, in order to maintain consistency.
Example:
Migration migration = Migration("Add New User Column", addNewUserColumn);
Migration migration2 = Migration("Migrate the Customer SQL table to Hive", migrateCustomerSQLTableToHive);
Schema schema = Schema("Example", [migration, migration2], context);
UniversalMigrationEngine ume = await UniversalMigrationEngine.create(MigrationEngine(), () => UniversalMigrationEngine.isFirstApplicationStart(), schemas: [schema]);
await ume.run();
New Applications - No migrations will run. It is assumed the schema is up-to-date. migration1 and migration2
will never run.
Older Applications - If the UME DB already exists on the application, migration1 or migration2 will execute in order
depending on if they have been executed before or not. Otherwise, if the UME Db does not exist, it will be created
and both migrations be executed.
Executing a migration consists of invoking the function provided to the migration and passing the context associated with the schema.
Definitions
Migration - any action that is intended to run once on older versions of applications to get the schema compatible
with the current version of the application runtime.
Schema - How data is organized. Migrations act on a schema and can be associated with a schema.