Files
Stride/migrations/versions/e57a0f824c61_persist_best_efforts.py
T

30 lines
881 B
Python

"""Persist versioned running best efforts and route availability."""
import sqlalchemy as sa
from alembic import op
revision = "e57a0f824c61"
down_revision = "d81b97ae5401"
branch_labels = None
depends_on = None
def upgrade():
with op.batch_alter_table("activity") as batch_op:
batch_op.add_column(
sa.Column("best_efforts", sa.JSON(), nullable=False, server_default="[]")
)
batch_op.add_column(
sa.Column("efforts_version", sa.Integer(), nullable=False, server_default="0")
)
batch_op.add_column(
sa.Column("has_route", sa.Boolean(), nullable=False, server_default=sa.false())
)
def downgrade():
with op.batch_alter_table("activity") as batch_op:
batch_op.drop_column("has_route")
batch_op.drop_column("efforts_version")
batch_op.drop_column("best_efforts")