Exemplo n.º 1
0
        public async Task ExecuteAsync_ValidatesMigrationsBeforeSelecting()
        {
            var migrations = new[] { Substitute.For <IDatabaseMigration>() };

            await sut.ExecuteAsync();

            Received.InOrder(() =>
            {
                migrationRegistry.ValidateMigrations();
                migrationSelector.SelectMigrationsAsync(Arg.Any <DatabaseMigrationSpecifier[]>(), Arg.Any <string[]>());
            });
        }
Exemplo n.º 2
0
        private void DiscoverAndRegister()
        {
            if (hasDiscoveryRun)
            {
                return;
            }

            int migrationCount = 0;

            foreach (var discovery in migrationDiscoveries)
            {
                var migrations = discovery.DiscoverMigrations();
                foreach (var migration in migrations)
                {
                    migrationRegistry.AddMigration(migration);
                    migrationCount++;
                }
            }

            migrationRegistry.ValidateMigrations();

            Logger.Debug($"Discovered {migrationCount} database migrations");
            hasDiscoveryRun = true;
        }