Create an alembic migration context.
966545
def create_migration_ctx(**kwargs):
    """"""
    env = EnvironmentContext(Config(), None)
    env.configure(
        connection=db.engine.connect(),
        sqlalchemy_module_prefix='db.',
        **kwargs
    )
    return env.get_context()
1125641
protected function createMigrationHistoryTable()
    {
        $tableName = $this->db->schema->getRawTableName($this->migrationTable);

        $this->db->createCommand()->createTable($this->migrationTable, [
            'version' => 'varchar(180) NOT NULL PRIMARY KEY',
            'apply_time' => 'integer',
        ])->execute();
        $this->db->createCommand()->insert($this->migrationTable, [
            'version' => self::BASE_MIGRATION,
            'apply_time' => time(),
        ])->execute();
    }
657705
def merge(self, name='initial'):
        """"""
        migrator = Migrator(self.database)
        migrate = compile_migrations(migrator, self.migrator.orm.values())
        if not migrate:
            return self.logger.error("Can't merge migrations")

        self.clear()

        self.logger.info('Merge migrations into "%s"', name)
        rollback = compile_migrations(self.migrator, [])
        name = self.compile(name, migrate, rollback, 0)

        migrator = Migrator(self.database)
        self.run_one(name, migrator, fake=True, force=True)
        self.logger.info('Migrations has been merged into "%s"', name)
1017448
def createdb():
    """"""
    manager.db.engine.echo = True
    manager.db.create_all()
    set_alembic_revision()
1020739
def current(directory=None, verbose=False, head_only=False):
    """"""
    config = current_app.extensions['migrate'].migrate.get_config(directory)
    if alembic_version >= (0, 7, 0):
        command.current(config, verbose=verbose, head_only=head_only)
    else:
        command.current(config)
1094190
def run_migrations_online():
    
    set_mysql_engine()
    engine = session.create_engine(neutron_config.database.connection)

    connection = engine.connect()
    context.configure(
        connection=connection,
        target_metadata=target_metadata,
        include_object=include_object,
        version_table=alembic_migrations.VERSION_TABLE
    )

    try:
        with context.begin_transaction():
            context.run_migrations()
    finally:
        connection.close()
        engine.dispose()
1051944
def create_migration(self, app, fixture_path):
        
        self.monkey_patch_migration_template(app, fixture_path)

        out = StringIO()
        management.call_command('makemigrations', app.label, empty=True, stdout=out)

        self.restore_migration_template()

        self.stdout.write(out.getvalue())
588194
def create_schema(alembic_config_ini=None):
    
    Base.metadata.create_all()
    if alembic_config_ini:
        from alembic.config import Config
        from alembic import command
        alembic_cfg = Config(alembic_config_ini)
        command.stamp(alembic_cfg, 'head')
390711
def _MigrateArtifact(artifact):
  """"""
  name = Text(artifact.name)

  try:
    logging.info("Migating %s", name)
    data_store.REL_DB.WriteArtifact(artifact)
    logging.info("  Wrote %s", name)
  except db.DuplicatedArtifactError:
    logging.info("  Skipped %s, because artifact already exists.", name)
1224166
protected function createMigrationHistoryTable()
    {
        $tableName = $this->db->schema->getRawTableName($this->migrationTable);
        $this->stdout("Creating migration history table \"$tableName\"...", Console::FG_YELLOW);
        $this->db->createCommand()->createTable($this->migrationTable, [
            'version'    => 'VARCHAR(180) NOT NULL PRIMARY KEY',
            'apply_time' => 'INTEGER',
        ])->execute();
        $this->db->createCommand()->insert($this->migrationTable, [
            'version' => self::BASE_MIGRATION,
            'apply_time' => time(),
        ])->execute();
        $this->stdout("Done.\n", Console::FG_GREEN);
    }
751003
public static function migrate() {
        $connection = \DLModel::getConnectionResolver()->connection();
        if ($connection->getPdo()) {
            $builder = $connection->getSchemaBuilder();
            if (!$builder->hasTable('modules')) {
                foreach (glob(__DIR__ . '/../../migrations/app/*.php') as $file) {
                    $migration = require($file);
                    if (is_array($migration)) {
                        $builder->create($connection->getTablePrefix() . key($migration), current($migration));
                    }
                }
            }
        }
    }
886011
function create(){
        var cmd = (migrateBinPath + " create " + grunt.option('name')).trim();

        grunt.log.write('Creating a new migration named "' + grunt.option('name') + '"...').ok();
        run(cmd);
    }
891518
def migrate(schema_file, config_file):
    ''''''

    schema = load_schema_file(open(schema_file, 'r'))
    config = load_config_file(config_file, open(config_file, 'r').read())

    config = append_existing_values(schema, config)

    migrated_config = generate_config_parser(config)
    migrated_config.write(sys.stdout)
1162164
protected function createMigrations()
    {
        file_put_contents(
            $this->createUsersVerificationsMigration(),
            file_get_contents(__DIR__.'/stubs/migrations/users_verifications.stub')
        );

        file_put_contents(
            $this->createUsersMigration(),
            file_get_contents(__DIR__.'/stubs/migrations/users.stub')
        );

        $this->info('Migrations created successfully!');
    }
1151020
def merge(directory=None, revisions='', message=None, branch_label=None,
          rev_id=None):
    """"""
    if alembic_version >= (0, 7, 0):
        config = current_app.extensions['migrate'].migrate.get_config(
            directory)
        command.merge(config, revisions, message=message,
                      branch_label=branch_label, rev_id=rev_id)
    else:
        raise RuntimeError('Alembic 0.7.0 or greater is required')
1356141
def migrate(engine, database, module, **kwargs):
    '''
    
    '''
    validate_args(engine, database, module)

    options = {
        'direction': kwargs.get('direction', 'up'),
        'fake': kwargs.get('fake', False),
        'force': kwargs.get('force', False),
        'migration': kwargs.get('migration', None),
        'transaction': kwargs.get('transaction', True),
    }

    Migration._meta.database = database
    migrator = DATABASE_MAP[engine](database, module, **options)
    migrator.run()
489711
def migrate(action):
    "  "
    from flaskext.evolution import Evolution
    from flask import current_app
    evolution = Evolution(current_app)
    evolution.manager(action)