c2corg / v6_api

REST API for https://www.camptocamp.org
GNU Affero General Public License v3.0
22 stars 26 forks source link

Set up Alembic for database migrations #476

Closed tsauerwein closed 7 years ago

tsauerwein commented 7 years ago

After the go-live we will need Alembic to update the production database.

asaunier commented 7 years ago

I don't think this issue should be tagged "blocking".

Alembic is a tool used to propagate structure changes in an existing database: http://alembic.zzzcomputing.com/en/latest/

As for now, when a new table is added to the database or a new column is added to a table, we simply drop and recreate the database of the demo. When the database will be in prod, it will no longer be possible to do so.

I don't think we need such a tool before the golive, or even not before changes in the productive data structure are required.

@tsauerwein could you confirm?

tsauerwein commented 7 years ago

If we urgently have the need to do structural changes to the production database, it would be very useful to have Alembic already set up. For sure, you can also simply run the commands on the production database but then how do you remember which state your database is in, which commands you have run,... These kind of problems Alembic was invented for.

stef74 commented 7 years ago

@tsauerwein according to your remarks ... we can consider is important but not blocking ?

tsauerwein commented 7 years ago

Yes, I started working on it.

tsauerwein commented 7 years ago

Alembic is set up. What is left to do is to figure out how to run a database migration in the Docker environment. But this is not blocking (I removed the label) and can be done after the go live.

tsauerwein commented 7 years ago

Upgrading the production database with Alembic is documented here: https://github.com/c2corg/v6_api/wiki/Upgrade-the-prod-server