public static int Main(string[] args) { if (args.Length < 3) { Console.WriteLine("Usage: RunMongoMigrations server[:port] databaseName migrationAssembly"); return 1; } var server = args[0]; var database = args[1]; var migrationsAssembly = args[2]; var runner = new MigrationRunner(("mongodb://" + server), database); runner.MigrationLocator.LookForMigrationsInAssembly(Assembly.LoadFrom(migrationsAssembly)); try { runner.UpdateToLatest(); return 0; } catch (MigrationException e) { Console.WriteLine("Migrations Failed: " + e); Console.WriteLine(args[0], args[1], args[2]); return 1; } }
public void TestMigration() { var runner = new MigrationRunner("mongodb://*****:*****@clickmongoqa.cloudapp.net:13878/clickberry"); // migrations are ordered by version runner.MigrationLocator.LookForMigrationsInAssemblyOfType<IPortalMigration>(); // updating database runner.UpdateToLatest(); runner.DatabaseStatus.ThrowIfNotLatestVersion(); }
public void Initialize() { var runner = new MigrationRunner(_url); // migrations are ordered by version runner.MigrationLocator.LookForMigrationsInAssemblyOfType<IPortalMigration>(); if (_automigration) { // updating database runner.UpdateToLatest(); } runner.DatabaseStatus.ThrowIfNotLatestVersion(); }
public static void EnsureLatest(string connectionString, string databaseName) { if (_isUpdating) return; _isUpdating = true; try { var runner = new MigrationRunner(connectionString, databaseName); runner.MigrationLocator.LookForMigrationsInAssemblyOfType<ErrorRepository>(); runner.UpdateToLatest(); } catch (Exception ex) { Log.Error().Exception(ex).Message("Error ensuring latest db version: {0}", ex.Message).Report().Write(); } finally { _isUpdating = false; } }
public static void EnsureLatest(string connectionString, string databaseName) { var runner = new MigrationRunner(connectionString, databaseName); runner.MigrationLocator.LookForMigrationsInAssemblyOfType<ErrorRepository>(); runner.UpdateToLatest(); }