-
Notifications
You must be signed in to change notification settings - Fork 20
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
Conversation
8981dd4
to
e56eb97
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
No description provided.