示例#1
0
        /// <summary>
        /// Executes all found (and unapplied) migrations
        /// </summary>
        /// <param name="assembly">Assembly to find the migration;
        /// leave null to search migration on the whole application pull</param>
        public void ApplyDownMigrations(Assembly assembly = null)
        {
            var migrations = GetMigrations(assembly).Reverse();

            foreach (var migrationInfo in migrations)
            {
                _migrationRunner.Down(migrationInfo.Migration);
                _versionLoader.DeleteVersion(migrationInfo.Version);
            }
        }
        /// <summary>
        /// Executes all found (and applied) migrations
        /// </summary>
        /// <param name="assembly">Assembly to find the migration</param>
        public void ApplyDownMigrations(Assembly assembly)
        {
            if (assembly is null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            foreach (var migrationInfo in GetDownMigrations(assembly).Reverse())
            {
                _migrationRunner.Down(migrationInfo.Migration);
                _versionLoader.Value.DeleteVersion(migrationInfo.Version);
            }
        }
        /// <summary>
        /// Executes all found (and unapplied) migrations
        /// </summary>
        /// <param name="assembly">Assembly to find the migration;
        /// leave null to search migration on the whole application pull</param>
        public void ApplyDownMigrations(Assembly assembly = null)
        {
            var migrations = GetMigrations(assembly).Reverse();

            foreach (var migrationInfo in migrations)
            {
                if (migrationInfo.Migration.GetType().GetCustomAttributes(typeof(SkipMigrationAttribute)).Any())
                {
                    continue;
                }

                _migrationRunner.Down(migrationInfo.Migration);
                _versionLoader.Value.DeleteVersion(migrationInfo.Version);
            }
        }
示例#4
0
 /// <summary>
 /// Down migration to the specific version
 /// </summary>
 /// <param name="migration">Specific migration to run down</param>
 public void RunMigrationDown(IMigration migration)
 {
     _migrationRunner.Down(migration);
 }