Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Alembic migrations using flask-alembic #15

Merged
merged 1 commit into from
Jun 27, 2017

Conversation

zalun
Copy link
Contributor

@zalun zalun commented Jun 23, 2017

No description provided.

@zalun zalun self-assigned this Jun 23, 2017
@zalun zalun requested review from mars-f and purelogiq June 23, 2017 10:09
@zalun zalun removed their assignment Jun 23, 2017
@zalun zalun force-pushed the add-migrations branch 4 times, most recently from 8981dd4 to e56eb97 Compare June 27, 2017 17:36
Copy link
Contributor

@mars-f mars-f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 question, and 1 change requested.

Also, is the new schema.db binary file included in this patch part of Alembic? I doesn't appear to be handled by the Dockerfile or any other code.

@@ -12,6 +12,8 @@ RUN apk --update --no-cache add \
RUN mkdir /db
RUN chown app:app /db

COPY migrations /migrations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also need to be applied to Dockerfile-dev?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is linked in docker-compose

tasks.py Outdated
def create_db(ctx):
"""Call `create_all` on a SQLAlchemy database."""
@task
def revision(ctx, msg):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to something more intuitive, like add-migration? Running invoke add-migration to start a new migration from a template sounds more intuitive than invoke revision, especially if the developer isn't familiar with Alembic terminology.

@zalun zalun changed the title WIP Add Alembic migrations using flask-alembic Add Alembic migrations using flask-alembic Jun 27, 2017
Copy link
Contributor

@purelogiq purelogiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with mars' suggestions implemented.

We're using Alembic with Flask-Alembic.
Added revision and upgrade manage.py commands.
Created a initialization migration.
Removed the schema file, `upgrade` is used to create the tables.
Use `invoke add-migration {name-of-revision}` to create a migration revision.
@zalun zalun merged commit c6a333d into mozilla-conduit:master Jun 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants