Improve mako template for migrations.

This commit is contained in:
Alexis Lahouze 2017-05-19 08:57:47 +02:00
parent ea83ca3610
commit 4b6c52dce6

View File

@ -6,19 +6,27 @@ Create Date: ${create_date}
""" """
# revision identifiers, used by Alembic. # pylint: disable=no-member
revision = ${repr(up_revision)} # flake8: noqa
down_revision = ${repr(down_revision)} # flake8: noqa
branch_labels = ${repr(branch_labels)} # flake8: noqa
depends_on = ${repr(depends_on)} # flake8: noqa
from alembic import op # revision identifiers, used by Alembic.
import sqlalchemy as sa # pylint: disable=invalid-name
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}
branch_labels = ${repr(branch_labels)}
depends_on = ${repr(depends_on)}
# pylint: enable=invalid-name
# pylint: disable=wrong-import-position
from alembic import op # noqa
import sqlalchemy as sa # noqa
${imports if imports else ""} ${imports if imports else ""}
# pylint: enable=wrong-import-position
def upgrade(): def upgrade():
"""Upgrades for revision ${up_revision}"""
${upgrades if upgrades else "pass"} ${upgrades if upgrades else "pass"}
def downgrade(): def downgrade():
"""Downgrades for revision ${up_revision}"""
${downgrades if downgrades else "pass"} ${downgrades if downgrades else "pass"}