57 lines
2.1 KiB
Python
57 lines
2.1 KiB
Python
"""empty message
|
|
|
|
Revision ID: b7cfe0c17708
|
|
Revises: 9741fc7834da
|
|
Create Date: 2018-01-21 17:24:52.587814
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'b7cfe0c17708'
|
|
down_revision = '9741fc7834da'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('sports',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('label', sa.String(length=50), nullable=False),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('label')
|
|
)
|
|
op.create_table('activities',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
sa.Column('sport_id', sa.Integer(), nullable=False),
|
|
sa.Column('gpx', sa.String(length=255), nullable=True),
|
|
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
|
sa.Column('modification_date', sa.DateTime(), nullable=True),
|
|
sa.Column('activity_date', sa.DateTime(), 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=2), 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(['sport_id'], ['sports.id'], ),
|
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('activities')
|
|
op.drop_table('sports')
|
|
# ### end Alembic commands ###
|