Example #1
0
 private void SolveDependency(IDbRoot root, string filePath, IMigration migration)
 {
     foreach (var migrationId in migration.MigrationsNeeded.Where(x => !root.MigrationHistory.HasMigration(x)))
     {
         // For each dependency that needs to be solved, we solve the subdependencies
         var dependency = this.migrations[migrationId];
         this.SolveDependency(root, filePath, dependency);
         dependency.Apply(root, filePath);
         root.MigrationHistory.AddMigration(migrationId);
     }
 }
Example #2
0
 private void SolveDependency(IDbRoot root, string filePath, IMigration migration)
 {
     foreach (var migrationId in migration.MigrationsNeeded.Where(x => !root.MigrationHistory.HasMigration(x)))
     {
         // For each dependency that needs to be solved, we solve the subdependencies
         var dependency = this.migrations[migrationId];
         this.SolveDependency(root, filePath, dependency);
         dependency.Apply(root, filePath);
         root.MigrationHistory.AddMigration(migrationId);
     }
 }
Example #3
0
 public void ApplyMigrations(IDbRoot root, string filePath)
 {
     var hasDoneSomething = false;
     this.migrations.ForEach(x =>
         {
             if (!root.MigrationHistory.HasMigration(x.Key))
             {
                 this.SolveDependency(root, filePath, x.Value);
                 x.Value.Apply(root, filePath);
                 root.MigrationHistory.AddMigration(x.Key);
                 hasDoneSomething = true;
             }
         });
     // It's useless to serialize / write stuff when you've done nothing, right ?
     if (hasDoneSomething)
     {
         this.persistVersionCallback();
     }
 }
Example #4
0
        public void ApplyMigrations(IDbRoot root, string filePath)
        {
            var hasDoneSomething = false;

            this.migrations.ForEach(x =>
            {
                if (!root.MigrationHistory.HasMigration(x.Key))
                {
                    this.SolveDependency(root, filePath, x.Value);
                    x.Value.Apply(root, filePath);
                    root.MigrationHistory.AddMigration(x.Key);
                    hasDoneSomething = true;
                }
            });
            // It's useless to serialize / write stuff when you've done nothing, right ?
            if (hasDoneSomething)
            {
                this.persistVersionCallback();
            }
        }