Skip to content

Cassandra Migrator

Youssef Benhessou edited this page Jun 7, 2020 · 1 revision

Cassandra Migrator

Interface : ICassandraMigrator

Handler : CassandraMigrator

This class is the core of the library, it's the one responsible for fetching and executing all the registred Migrations from the {Services Provider} of the application.

With every registered migration, the migrator checks if it's already applied, If True, it skips the migration otherwise it applies it using the {ApplyMigration()} of the Migration.

  • The Handler exposes the following methods:
/// <summary>
/// Start the migration process.
///
/// The method fetch the registered migrations from the {Services Provider} of the app.
/// Before appling a migration, the method checks if its already applied, If True, it skipps
/// the migration otherwise applies it using the {ApplyMigration()} of the Migration.
/// </summary>
///
/// <returns>Count of the applied migrations.</returns>
int Migrate();

/// <summary>
/// Get the latest migration that was applied to the schema.
/// </summary>
///
/// <returns>Migration history details.</returns>
MigrationHistory GetLatestMigration();

/// <summary>
/// Gets the list of the registered migrations from the app {services provider}.
/// The migrations are automatically sorted older to latest.
/// </summary>
///
/// <returns>List of migrations.</returns>
ICollection<IMigrator> GetRegistredMigrations();

/// <summary>
/// Gets the list of the applied migrations from the database.
/// The migrations are automatically sorted latest to older.
/// </summary>
///
/// <returns>List of migrations.</returns>
ICollection<MigrationHistory> GetAppliedMigration();
Clone this wiki locally