diff --git a/alembic/templates/async/script.py.mako b/alembic/templates/async/script.py.mako index fbc4b07d..480b130d 100644 --- a/alembic/templates/async/script.py.mako +++ b/alembic/templates/async/script.py.mako @@ -19,8 +19,10 @@ depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)} def upgrade() -> None: + """Upgrade schema.""" ${upgrades if upgrades else "pass"} def downgrade() -> None: + """Downgrade schema.""" ${downgrades if downgrades else "pass"} diff --git a/alembic/templates/generic/script.py.mako b/alembic/templates/generic/script.py.mako index fbc4b07d..480b130d 100644 --- a/alembic/templates/generic/script.py.mako +++ b/alembic/templates/generic/script.py.mako @@ -19,8 +19,10 @@ depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)} def upgrade() -> None: + """Upgrade schema.""" ${upgrades if upgrades else "pass"} def downgrade() -> None: + """Downgrade schema.""" ${downgrades if downgrades else "pass"} diff --git a/alembic/templates/multidb/script.py.mako b/alembic/templates/multidb/script.py.mako index 6108b8a0..3caca7bf 100644 --- a/alembic/templates/multidb/script.py.mako +++ b/alembic/templates/multidb/script.py.mako @@ -22,10 +22,12 @@ depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)} def upgrade(engine_name: str) -> None: + """Upgrade schema.""" globals()["upgrade_%s" % engine_name]() def downgrade(engine_name: str) -> None: + """Downgrade schema.""" globals()["downgrade_%s" % engine_name]() <% @@ -38,10 +40,12 @@ def downgrade(engine_name: str) -> None: % for db_name in re.split(r',\s*', db_names): def upgrade_${db_name}() -> None: + """Upgrade ${db_name} schema.""" ${context.get("%s_upgrades" % db_name, "pass")} def downgrade_${db_name}() -> None: + """Downgrade ${db_name} schema.""" ${context.get("%s_downgrades" % db_name, "pass")} % endfor