feat: build Stride local app with Garmin imports and friends-only sharing
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
"""Create users and activities
|
||||
|
||||
Revision ID: 3a2896986e0e
|
||||
Revises:
|
||||
Create Date: 2026-09-30 21:11:01.589912
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "3a2896986e0e"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
"user",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("username", sa.String(length=40), nullable=False),
|
||||
sa.Column("email", sa.String(length=254), nullable=False),
|
||||
sa.Column("display_name", sa.String(length=80), nullable=False),
|
||||
sa.Column("password_hash", sa.String(length=256), nullable=False),
|
||||
sa.Column("timezone", sa.String(length=64), nullable=False),
|
||||
sa.Column("local_account_key", sa.String(length=64), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("email"),
|
||||
sa.UniqueConstraint("local_account_key"),
|
||||
sa.UniqueConstraint("username"),
|
||||
)
|
||||
op.create_table(
|
||||
"activity",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("owner_id", sa.Integer(), nullable=False),
|
||||
sa.Column("source_key", sa.String(length=180), nullable=False),
|
||||
sa.Column("title", sa.String(length=160), nullable=False),
|
||||
sa.Column("sport", sa.String(length=40), nullable=False),
|
||||
sa.Column("started_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("distance_m", sa.Float(), nullable=False),
|
||||
sa.Column("duration_s", sa.Float(), nullable=False),
|
||||
sa.Column("elevation_m", sa.Float(), nullable=False),
|
||||
sa.Column("avg_hr", sa.Float(), nullable=True),
|
||||
sa.Column("visibility", sa.String(length=12), nullable=False),
|
||||
sa.Column("share_route", sa.Boolean(), nullable=False),
|
||||
sa.Column("samples", sa.JSON(), nullable=False),
|
||||
sa.Column("laps", sa.JSON(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["owner_id"],
|
||||
["user.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("owner_id", "source_key"),
|
||||
)
|
||||
with op.batch_alter_table("activity", schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f("ix_activity_owner_id"), ["owner_id"], unique=False)
|
||||
batch_op.create_index(batch_op.f("ix_activity_started_at"), ["started_at"], unique=False)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("activity", schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f("ix_activity_started_at"))
|
||||
batch_op.drop_index(batch_op.f("ix_activity_owner_id"))
|
||||
|
||||
op.drop_table("activity")
|
||||
op.drop_table("user")
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user