Ejemplo n.º 1
0
        public static async Task PlanAndMigrate(this ISchemaMigrator migrator, IDbConnection connection, ISchemaManager targetManager, ObjectSchema targetSchema, MigrationOptions options)
        {
            var plan = await migrator.PlanMigration(
                connection : connection,
                targetManager : targetManager,
                targetSchema : targetSchema,
                options : options
                );

            await migrator.ExecuteMigration(
                connection : connection,
                targetManager : targetManager,
                migrationPlan : plan
                );
        }
 public ProviderDelegator(
     ISchemaCache schemaCache,
     ISchemaMigrator migrator,
     IObjectSchemaExtractor extractor,
     IEnumerable <ISchemaManager> managers,
     IEnumerable <ISchemaQuerier> queriers,
     IEnumerable <IConnectionFactory> connectors
     )
 {
     this.Migrator    = migrator;
     this.Managers    = managers;
     this.Queriers    = queriers;
     this.Extractor   = extractor;
     this.Connectors  = connectors;
     this.SchemaCache = schemaCache;
 }
Ejemplo n.º 3
0
        private ISchemaMigrator[] GetMigrations(string schemaVersion)
        {
            if (schemaVersion == "1.0")
            {
                return(AllMigrators);
            }

            ISchemaMigrator[] all = AllMigrators;
            int startIndex        = -1;

            for (int i = 0; i < all.Length; i++)
            {
                if (all[i].MigratedVersion == schemaVersion)
                {
                    startIndex = i + 1;
                    break;
                }
            }

            ISchemaMigrator[] ret = new ISchemaMigrator[all.Length - startIndex];
            all.CopyTo(ret, startIndex);
            return(ret);
        }