Make the 'alembic_version' table name configurable

Issue #214 closed
Joshua Ulmer
created an issue

It would be nice if this was a configurable option.

Comments (2)

  1. HanJong Ko

    To someone like me looking for the exact same thing in 2017 or later.

    This is unbroken API document url for repo owner mentioned. http://alembic.zzzcomputing.com/en/latest/api/runtime.html?highlight=environmentcontext#alembic.runtime.environment.EnvironmentContext.configure.params.version_table

    And this is example of how to use it.

    # in env.py
    
    # note. "online"
    def run_migrations_online():
        """Run migrations in 'online' mode.
    
        In this scenario we need to create an Engine
        and associate a connection with the context.
    
        """
        connectable = engine_from_config(
            config.get_section(config.config_ini_section),
            prefix='sqlalchemy.',
            poolclass=pool.NullPool)
    
        with connectable.connect() as connection:
            context.configure(
                connection=connection,
                target_metadata=target_metadata,
                version_table='your_alembic_version_tbl_name',   #   -------------------- here is the magic ----------------
            )
    
            with context.begin_transaction():
                context.run_migrations()
    
  2. Log in to comment