Example #1
0
 public Runner(IDataClient dataClient, Assembly targetAssembly, IVersionRepository versionRepository)
 {
     _dataClient = dataClient;
     _databaseKind = _dataClient.Database.Provider.DatabaseKind;
     _targetAssembly = targetAssembly ?? Assembly.GetCallingAssembly();
     VersionRepository = versionRepository;
     _migrationFinder = new MigrationFinder(_targetAssembly);
     _initialVersion = -1;
 }
Example #2
0
        public void Run(long targetVersion)
        {
            List <MigrationInfo> migrationsFromAssembly = MigrationFinder.FindMigrations(_targetAssembly);

            VersionRepository.EnsureSchemaVersionTable(migrationsFromAssembly);
            List <long> migrationsFromDatabase = VersionRepository.GetAppliedMigrations();
            var         migrationPlan          = new MigrationPlan(migrationsFromDatabase, migrationsFromAssembly, targetVersion);

            RunMigrations(migrationPlan);
        }
Example #3
0
        public void Run(string seedName, string param = null, string migrationGroup = null)
        {
            Type seedType = MigrationFinder.FindSeed(_targetAssembly, seedName);

            Log.Info("Starting seed migration");
            Log.Info("Migration group: " + VersionRepository.GetMigrationGroup(migrationGroup));
            Log.Info(String.Format("Applying Seed -> [{0}]", seedName));

            var migration = (SeedMigration)Activator.CreateInstance(seedType);

            migration.SetDataClient(_dataClient);
            migration.Up(param);
            _dataClient.Commit();
        }