Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use different .ini file for alembic.ini

I'm attempting to configure SQLAlchemy Alembic for my Pyramid project and I want to use my developement.ini (or production.ini) for the configuration settings for Alembic. Is it possible to specify the .ini file I wish to use anywhere within Alembic?

like image 608
Vincent Catalano Avatar asked Oct 06 '12 05:10

Vincent Catalano


People also ask

What is alembic INI file?

alembic init alembic From there, you can create tables or migrate functions for example. After the init command, a folder structure is created. The file named 'alembic.ini' is called every time Alembic is used. It contains all the basic information that makes it possible to connect to the database of your choice.

How do you change heads in alembic?

Show activity on this post. Delete (or move to another folder) the specific migration file (in migrations/versions folder). The head will automatically revert to the most recent remaining migration. Using stamp will set the db version value to the specified revision; not alter the head revision number.

How do you run all alembic migrations?

Alembic is keeping track of the migrations in the alembic_version table on your database. Simple drop the table to start from scratch using the following command: DROP TABLE alembic_version; And then try to run your migration again!

How do I downgrade my alembic?

If you want to run to downgrade() of a version, you will need to run alembic downgrade the-version-before-it , which mean it will revert to the version after the version that you want to downgrade.


1 Answers

Just specify alembic -c /some/path/to/another.ini when running alembic commands. You could even put the [alembic] section in your development.ini and production.ini files and just alembic -c production.ini upgrade head.

like image 151
Michael Merickel Avatar answered Sep 23 '22 21:09

Michael Merickel