Simplify the docstrings of the migrations
The "Revision" and "Revises" lines and the revision hashes in `upgrade()` and `downgrade()` repeated the `revision` and `down_revision` variables; the creation date is in the file name.
This commit is contained in:
parent
f532aae588
commit
db2e00216d
5 changed files with 17 additions and 35 deletions
|
|
@ -1,8 +1,4 @@
|
|||
"""${message}.
|
||||
|
||||
Revision: # ${up_revision} at ${create_date}
|
||||
Revises: # ${down_revision | comma,n}
|
||||
"""
|
||||
"""${message}."""
|
||||
|
||||
import os
|
||||
|
||||
|
|
@ -12,20 +8,21 @@ ${imports if imports else ""}
|
|||
|
||||
from velofy import configuration
|
||||
|
||||
|
||||
revision = ${repr(up_revision)}
|
||||
down_revision = ${repr(down_revision)}
|
||||
branch_labels = ${repr(branch_labels)}
|
||||
depends_on = ${repr(depends_on)}
|
||||
|
||||
|
||||
config = configuration.make_config('testing' if os.getenv('TESTING') else 'production')
|
||||
config = configuration.make_config("testing" if os.getenv("TESTING") else "production")
|
||||
|
||||
|
||||
def upgrade():
|
||||
"""Upgrade to revision ${up_revision}."""
|
||||
"""Upgrade to the next revision."""
|
||||
${upgrades if upgrades else "pass"}
|
||||
|
||||
|
||||
def downgrade():
|
||||
"""Downgrade to revision ${down_revision}."""
|
||||
"""Downgrade to the previous revision."""
|
||||
${downgrades if downgrades else "pass"}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
"""Create the database from scratch.
|
||||
|
||||
Revision: #f11cd76d2f45 at 2020-08-06 23:24:32
|
||||
"""
|
||||
"""Create the database from scratch."""
|
||||
|
||||
import os
|
||||
|
||||
|
|
@ -22,7 +19,7 @@ config = configuration.make_config("testing" if os.getenv("TESTING") else "produ
|
|||
|
||||
|
||||
def upgrade():
|
||||
"""Upgrade to revision f11cd76d2f45."""
|
||||
"""Upgrade to the next revision."""
|
||||
op.execute(f"CREATE SCHEMA {config.CLEAN_SCHEMA};")
|
||||
op.create_table(
|
||||
"cities",
|
||||
|
|
@ -806,5 +803,5 @@ def upgrade():
|
|||
|
||||
|
||||
def downgrade():
|
||||
"""Downgrade to revision None."""
|
||||
"""Downgrade to the previous revision."""
|
||||
op.execute(f"DROP SCHEMA {config.CLEAN_SCHEMA} CASCADE;")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
"""Add pixel grid.
|
||||
|
||||
Revision: #888e352d7526 at 2021-01-02 18:11:02
|
||||
Revises: #f11cd76d2f45
|
||||
"""
|
||||
"""Add pixel grid."""
|
||||
|
||||
import os
|
||||
|
||||
|
|
@ -22,7 +18,7 @@ config = configuration.make_config("testing" if os.getenv("TESTING") else "produ
|
|||
|
||||
|
||||
def upgrade():
|
||||
"""Upgrade to revision 888e352d7526."""
|
||||
"""Upgrade to the next revision."""
|
||||
op.create_table(
|
||||
"grids",
|
||||
sa.Column("id", sa.SmallInteger(), autoincrement=True, nullable=False),
|
||||
|
|
@ -153,7 +149,7 @@ def upgrade():
|
|||
|
||||
|
||||
def downgrade():
|
||||
"""Downgrade to revision f11cd76d2f45."""
|
||||
"""Downgrade to the previous revision."""
|
||||
op.drop_table("addresses_pixels", schema=config.CLEAN_SCHEMA)
|
||||
op.drop_constraint(
|
||||
"uq_addresses_on_id_city_id",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
"""Add demand forecasting.
|
||||
|
||||
Revision: #e40623e10405 at 2021-01-06 19:55:56
|
||||
Revises: #888e352d7526
|
||||
"""
|
||||
"""Add demand forecasting."""
|
||||
|
||||
import os
|
||||
|
||||
|
|
@ -23,7 +19,7 @@ config = configuration.make_config("testing" if os.getenv("TESTING") else "produ
|
|||
|
||||
|
||||
def upgrade():
|
||||
"""Upgrade to revision e40623e10405."""
|
||||
"""Upgrade to the next revision."""
|
||||
op.create_table(
|
||||
"forecasts",
|
||||
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
||||
|
|
@ -93,5 +89,5 @@ def upgrade():
|
|||
|
||||
|
||||
def downgrade():
|
||||
"""Downgrade to revision 888e352d7526."""
|
||||
"""Downgrade to the previous revision."""
|
||||
op.drop_table("forecasts", schema=config.CLEAN_SCHEMA)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
"""Add confidence intervals to forecasts.
|
||||
|
||||
Revision: #26711cd3f9b9 at 2021-01-20 16:08:21
|
||||
Revises: #e40623e10405
|
||||
"""
|
||||
"""Add confidence intervals to forecasts."""
|
||||
|
||||
import os
|
||||
|
||||
|
|
@ -23,7 +19,7 @@ config = configuration.make_config("testing" if os.getenv("TESTING") else "produ
|
|||
|
||||
|
||||
def upgrade():
|
||||
"""Upgrade to revision 26711cd3f9b9."""
|
||||
"""Upgrade to the next revision."""
|
||||
op.alter_column(
|
||||
"forecasts",
|
||||
"method",
|
||||
|
|
@ -109,7 +105,7 @@ def upgrade():
|
|||
|
||||
|
||||
def downgrade():
|
||||
"""Downgrade to revision e40623e10405."""
|
||||
"""Downgrade to the previous revision."""
|
||||
op.alter_column(
|
||||
"forecasts",
|
||||
"model",
|
||||
|
|
|
|||
Loading…
Reference in a new issue