Exemple #1
0
        public static Migration Load(MigrationMemento memento, IImmutableDictionary <BigInteger, Migration> migrationsByHashCode)
        {
            switch (memento.Type)
            {
            case nameof(UseSchemaMigration):
                return(UseSchemaMigration.FromMemento(memento, migrationsByHashCode));

            case nameof(CreateTableMigration):
                return(CreateTableMigration.FromMemento(memento, migrationsByHashCode));

            case nameof(CreateColumnMigration):
                return(CreateColumnMigration.FromMemento(memento, migrationsByHashCode));

            case nameof(CreatePrimaryKeyMigration):
                return(CreatePrimaryKeyMigration.FromMemento(memento, migrationsByHashCode));

            case nameof(CreateUniqueIndexMigration):
                return(CreateUniqueIndexMigration.FromMemento(memento, migrationsByHashCode));

            case nameof(CreateIndexMigration):
                return(CreateIndexMigration.FromMemento(memento, migrationsByHashCode));

            case nameof(CreateForeignKeyMigration):
                return(CreateForeignKeyMigration.FromMemento(memento, migrationsByHashCode));

            case nameof(CustomSqlMigration):
                return(CustomSqlMigration.FromMemento(memento, migrationsByHashCode));

            default:
                throw new ArgumentException($"Unknown type {memento.Type}");
            }
        }
Exemple #2
0
        public CustomSqlSpecification Execute(string up, string down = null)
        {
            var migration = new CustomSqlMigration(_databaseName, up, down, Prerequisites);

            MigrationHistoryBuilder.Append(migration);
            migration.AddToParent();
            return(new CustomSqlSpecification(migration, MigrationHistoryBuilder));
        }
 internal CustomSqlSpecification(CustomSqlMigration migration, MigrationHistoryBuilder migrationHistoryBuilder) :
     base(migrationHistoryBuilder)
 {
     _migration = migration;
 }