API: Activity segments table init
This commit is contained in:
@ -23,10 +23,9 @@ def upgrade():
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('sport_id', sa.Integer(), nullable=False),
|
||||
sa.Column('activity_id', sa.Integer(), nullable=False),
|
||||
sa.Column('record_type', sa.Enum('FD', 'LD', 'MS', name='record_types'), nullable=True),
|
||||
sa.Column('record_type', sa.Enum('AS', 'FD', 'LD', 'MS', name='record_types'), nullable=True),
|
||||
sa.Column('activity_date', sa.DateTime(), nullable=False),
|
||||
sa.Column('value_interval', sa.Interval(), nullable=True),
|
||||
sa.Column('value_float', sa.Numeric(precision=5, scale=3), nullable=True),
|
||||
sa.Column('value', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
|
||||
sa.ForeignKeyConstraint(['sport_id'], ['sports.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
|
43
mpwo_api/migrations/versions/dd73d23a7a3d_.py
Normal file
43
mpwo_api/migrations/versions/dd73d23a7a3d_.py
Normal file
@ -0,0 +1,43 @@
|
||||
"""create Activities Segments table
|
||||
|
||||
Revision ID: dd73d23a7a3d
|
||||
Revises: caf0e0dc621a
|
||||
Create Date: 2018-05-14 12:12:57.299200
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dd73d23a7a3d'
|
||||
down_revision = 'caf0e0dc621a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('activity_segments',
|
||||
sa.Column('activity_id', sa.Integer(), nullable=False),
|
||||
sa.Column('segment_id', sa.Integer(), nullable=False),
|
||||
sa.Column('duration', sa.Interval(), nullable=False),
|
||||
sa.Column('pauses', sa.Interval(), nullable=True),
|
||||
sa.Column('moving', sa.Interval(), nullable=True),
|
||||
sa.Column('distance', sa.Numeric(precision=5, scale=3), nullable=True),
|
||||
sa.Column('min_alt', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('max_alt', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('descent', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('ascent', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('max_speed', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('ave_speed', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
|
||||
sa.PrimaryKeyConstraint('activity_id', 'segment_id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('activity_segments')
|
||||
# ### end Alembic commands ###
|
Reference in New Issue
Block a user