コード例 #1
0
 def test_process_result_value_as_utc(self):
     dt = datetime(year,
                   month,
                   day,
                   hour,
                   tzinfo=tz.gettz('America/New_York'))
     value = types.DateTime().process_result_value(dt)
     assert dt == value
     assert value.tzinfo == timezone.utc
コード例 #2
0
 def test_process_bind_param_converts_to_utc(self):
     dt = datetime(year,
                   month,
                   day,
                   hour,
                   tzinfo=tz.gettz('America/New_York'))
     value = types.DateTime().process_bind_param(dt)
     assert dt == value
     assert value.tzinfo == timezone.utc
コード例 #3
0
 def test_process_result_value(self):
     dt = datetime(year, month, day, hour, tzinfo=timezone.utc)
     value = types.DateTime().process_result_value(dt)
     assert dt == value
     assert value.tzinfo == timezone.utc
コード例 #4
0
 def test_process_bind_param_requires_timezone_aware_dt(self):
     dt = datetime(year, month, day, hour)
     with pytest.raises(ValueError) as e:
         types.DateTime().process_bind_param(dt)
     assert 'Cannot persist timezone-naive datetime' in str(e)
コード例 #5
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'contact_submission',
        sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('email', sa.String(length=64), nullable=False),
        sa.Column('message', sa.Text(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_contact_submission')))
    op.create_table(
        'currency', sa.Column('iso_code', sa.String(length=3), nullable=False),
        sa.Column('iso_name', sa.String(length=32), nullable=False),
        sa.Column('name', sa.String(length=32), nullable=True),
        sa.Column('plural', sa.String(length=32), nullable=True),
        sa.Column('symbol', sa.String(length=8), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_currency')),
        sa.UniqueConstraint('plural', name=op.f('uq_currency_plural')))
    op.create_index(op.f('ix_currency_iso_code'),
                    'currency', ['iso_code'],
                    unique=True)
    op.create_index(op.f('ix_currency_iso_name'),
                    'currency', ['iso_name'],
                    unique=True)
    op.create_index(op.f('ix_currency_name'),
                    'currency', ['name'],
                    unique=True)
    op.create_table(
        'data_item', sa.Column('key', sa.String(length=32), nullable=False),
        sa.Column('update_frequency', sa.String(length=32), nullable=False),
        sa.Column('update_at', sa.String(length=32), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_data_item')))
    op.create_table(
        'data_vendor', sa.Column('key', sa.String(length=16), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('priority', sa.Integer(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_data_vendor')))
    op.create_index(op.f('ix_data_vendor_key'),
                    'data_vendor', ['key'],
                    unique=True)
    op.create_index(op.f('ix_data_vendor_name'),
                    'data_vendor', ['name'],
                    unique=True)
    op.create_table(
        'exchange', sa.Column('abbrev', sa.String(length=16), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_exchange')),
        sa.UniqueConstraint('abbrev', name=op.f('uq_exchange_abbrev')),
        sa.UniqueConstraint('name', name=op.f('uq_exchange_name')))
    op.create_table(
        'index', sa.Column('ticker', sa.String(length=16), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_index')))
    op.create_index(op.f('ix_index_name'), 'index', ['name'], unique=True)
    op.create_index(op.f('ix_index_ticker'), 'index', ['ticker'], unique=True)
    op.create_table(
        'role', sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_role')))
    op.create_index(op.f('ix_role_name'), 'role', ['name'], unique=True)
    op.create_table(
        'sector', sa.Column('name', sa.String(length=32), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_sector')))
    op.create_index(op.f('ix_sector_name'), 'sector', ['name'], unique=True)
    op.create_table(
        'user', sa.Column('email', sa.String(length=64), nullable=False),
        sa.Column('password', sa.String(), nullable=True),
        sa.Column('is_active', sa.Boolean(name='is_active'), nullable=False),
        sa.Column('confirmed_at',
                  sqla_bundle.DateTime(timezone=True),
                  nullable=True),
        sa.Column('username', sa.String(length=64), nullable=False),
        sa.Column('first_name', sa.String(length=64), nullable=False),
        sa.Column('last_name', sa.String(length=64), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_user')))
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_username'),
                    'user', ['username'],
                    unique=True)
    op.create_table(
        'country', sa.Column('iso_code', sa.String(length=2), nullable=False),
        sa.Column('iso_code3', sa.String(length=3), nullable=False),
        sa.Column('iso_name', sa.String(length=64), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=True),
        sa.Column('native_name', sa.String(length=64), nullable=True),
        sa.Column('currency_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['currency_id'], ['currency.id'],
            name=op.f('fk_country_to_currency_id_on_currency')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_country')),
        sa.UniqueConstraint('native_name',
                            name=op.f('uq_country_native_name')))
    op.create_index(op.f('ix_country_iso_code'),
                    'country', ['iso_code'],
                    unique=True)
    op.create_index(op.f('ix_country_iso_code3'),
                    'country', ['iso_code3'],
                    unique=True)
    op.create_index(op.f('ix_country_iso_name'),
                    'country', ['iso_name'],
                    unique=True)
    op.create_index(op.f('ix_country_name'), 'country', ['name'], unique=True)
    op.create_table(
        'data_item_vendor',
        sa.Column('data_item_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('data_vendor_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('priority', sa.Integer(), nullable=True),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['data_item_id'], ['data_item.id'],
            name=op.f('fk_data_item_vendor_to_data_item_id_on_data_item')),
        sa.ForeignKeyConstraint(
            ['data_vendor_id'], ['data_vendor.id'],
            name=op.f('fk_data_item_vendor_to_data_vendor_id_on_data_vendor')),
        sa.PrimaryKeyConstraint('data_item_id',
                                'data_vendor_id',
                                name=op.f('pk_data_item_vendor')))
    op.create_table(
        'index_data_vendor',
        sa.Column('index_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('data_vendor_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('ticker', sa.String(length=16), nullable=True),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['data_vendor_id'], ['data_vendor.id'],
            name=op.f(
                'fk_index_data_vendor_to_data_vendor_id_on_data_vendor')),
        sa.ForeignKeyConstraint(
            ['index_id'], ['index.id'],
            name=op.f('fk_index_data_vendor_to_index_id_on_index')),
        sa.PrimaryKeyConstraint('index_id',
                                'data_vendor_id',
                                name=op.f('pk_index_data_vendor')))
    op.create_table(
        'industry', sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('sector_id', sqla_bundle.BigInteger(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['sector_id'], ['sector.id'],
            name=op.f('fk_industry_to_sector_id_on_sector')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_industry')))
    op.create_index(op.f('ix_industry_name'),
                    'industry', ['name'],
                    unique=True)
    op.create_table(
        'user_role',
        sa.Column('user_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('role_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(['role_id'], ['role.id'],
                                name=op.f('fk_user_role_to_role_id_on_role')),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'],
                                name=op.f('fk_user_role_to_user_id_on_user')),
        sa.PrimaryKeyConstraint('user_id',
                                'role_id',
                                name=op.f('pk_user_role')))
    op.create_table(
        'watchlist', sa.Column('name', sa.String(), nullable=False),
        sa.Column('user_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'],
                                name=op.f('fk_watchlist_to_user_id_on_user')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_watchlist')))
    op.create_index(op.f('ix_watchlist_name'),
                    'watchlist', ['name'],
                    unique=True)
    op.create_table(
        'market', sa.Column('abbrev', sa.String(length=16), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('country_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('exchange_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['country_id'], ['country.id'],
            name=op.f('fk_market_to_country_id_on_country')),
        sa.ForeignKeyConstraint(
            ['exchange_id'], ['exchange.id'],
            name=op.f('fk_market_to_exchange_id_on_exchange')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_market')))
    op.create_table(
        'asset',
        sa.Column('type',
                  sa.Enum('Asset', 'Equity', name='assettype'),
                  nullable=False),
        sa.Column('ticker', sa.String(length=16), nullable=False),
        sa.Column('market_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(['market_id'], ['market.id'],
                                name=op.f('fk_asset_to_market_id_on_market')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_asset')))
    op.create_index(op.f('ix_asset_ticker'), 'asset', ['ticker'], unique=True)
    op.create_table(
        'asset_data_vendor',
        sa.Column('asset_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('data_vendor_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('ticker', sa.String(length=16), nullable=True),
        sa.Column('minutely_last_updated',
                  sqla_bundle.DateTime(timezone=True),
                  nullable=True),
        sa.Column('daily_last_updated',
                  sqla_bundle.DateTime(timezone=True),
                  nullable=True),
        sa.Column('weekly_last_updated',
                  sqla_bundle.DateTime(timezone=True),
                  nullable=True),
        sa.Column('monthly_last_updated',
                  sqla_bundle.DateTime(timezone=True),
                  nullable=True),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['asset_id'], ['asset.id'],
            name=op.f('fk_asset_data_vendor_to_asset_id_on_asset')),
        sa.ForeignKeyConstraint(
            ['data_vendor_id'], ['data_vendor.id'],
            name=op.f(
                'fk_asset_data_vendor_to_data_vendor_id_on_data_vendor')),
        sa.PrimaryKeyConstraint('asset_id',
                                'data_vendor_id',
                                name=op.f('pk_asset_data_vendor')))
    op.create_table(
        'equity', sa.Column('id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('company_name', sa.String(), nullable=False),
        sa.Column('company_description', sa.Text(), nullable=True),
        sa.Column('sector_id', sqla_bundle.BigInteger(), nullable=True),
        sa.Column('industry_id', sqla_bundle.BigInteger(), nullable=True),
        sa.ForeignKeyConstraint(['id'], ['asset.id'],
                                name=op.f('fk_equity_to_id_on_asset')),
        sa.ForeignKeyConstraint(
            ['industry_id'], ['industry.id'],
            name=op.f('fk_equity_to_industry_id_on_industry')),
        sa.ForeignKeyConstraint(['sector_id'], ['sector.id'],
                                name=op.f('fk_equity_to_sector_id_on_sector')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_equity')))
    op.create_index(op.f('ix_equity_company_name'),
                    'equity', ['company_name'],
                    unique=False)
    op.create_table(
        'watchlist_asset',
        sa.Column('asset_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('watchlist_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['asset_id'], ['asset.id'],
            name=op.f('fk_watchlist_asset_to_asset_id_on_asset')),
        sa.ForeignKeyConstraint(
            ['watchlist_id'], ['watchlist.id'],
            name=op.f('fk_watchlist_asset_to_watchlist_id_on_watchlist')),
        sa.PrimaryKeyConstraint('asset_id',
                                'watchlist_id',
                                name=op.f('pk_watchlist_asset')))
    op.create_table(
        'equity_index',
        sa.Column('equity_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('index_id', sqla_bundle.BigInteger(), nullable=False),
        sa.Column('created_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.Column('updated_at',
                  sa.DateTime(),
                  server_default=sa.text('now()'),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['equity_id'], ['equity.id'],
            name=op.f('fk_equity_index_to_equity_id_on_equity')),
        sa.ForeignKeyConstraint(
            ['index_id'], ['index.id'],
            name=op.f('fk_equity_index_to_index_id_on_index')),
        sa.PrimaryKeyConstraint('equity_id',
                                'index_id',
                                name=op.f('pk_equity_index')))
コード例 #6
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('exercise_type',
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_exercise_type'))
    )
    op.create_table('flask_sessions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('session_id', sa.String(length=255), nullable=False),
    sa.Column('data', sa.LargeBinary(), nullable=False),
    sa.Column('expiry', sa.DateTime(), nullable=True),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_flask_sessions')),
    sa.UniqueConstraint('session_id', name=op.f('uq_flask_sessions_session_id'))
    )
    op.create_table('location',
    sa.Column('name', sa.String(length=128), nullable=False),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_location'))
    )
    op.create_table('role',
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_role'))
    )
    op.create_index(op.f('ix_role_name'), 'role', ['name'], unique=True)
    op.create_table('user',
    sa.Column('email', sa.String(length=64), nullable=False),
    sa.Column('password', sa.String(), nullable=True),
    sa.Column('active', sa.Boolean(name='active'), nullable=False),
    sa.Column('confirmed_at', sqla_bundle.DateTime(timezone=True), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_user'))
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_table('user_role',
    sa.Column('user_id', sqla_bundle.BigInteger(), nullable=False),
    sa.Column('role_id', sqla_bundle.BigInteger(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.ForeignKeyConstraint(['role_id'], ['role.id'], name=op.f('fk_user_role_to_role_id_on_role')),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_user_role_to_user_id_on_user')),
    sa.PrimaryKeyConstraint('user_id', 'role_id', name=op.f('pk_user_role'))
    )
    op.create_table('workout',
    sa.Column('date', sa.Date(), nullable=False),
    sa.Column('user_id', sqla_bundle.BigInteger(), nullable=False),
    sa.Column('location_id', sqla_bundle.BigInteger(), nullable=False),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.ForeignKeyConstraint(['location_id'], ['location.id'], name=op.f('fk_workout_to_location_id_on_location')),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_workout_to_user_id_on_user')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_workout'))
    )
    op.create_table('exercise',
    sa.Column('workout_id', sqla_bundle.BigInteger(), nullable=False),
    sa.Column('exercise_type_id', sqla_bundle.BigInteger(), nullable=False),
    sa.Column('discriminator', sa.String(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.ForeignKeyConstraint(['exercise_type_id'], ['exercise_type.id'], name=op.f('fk_exercise_to_exercise_type_id_on_exercise_type')),
    sa.ForeignKeyConstraint(['workout_id'], ['workout.id'], name=op.f('fk_exercise_to_workout_id_on_workout')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_exercise'))
    )
    op.create_table('distance_exercise',
    sa.Column('distance', sa.Float(), nullable=False),
    sa.Column('distance_units', sa.String(length=16), nullable=False),
    sa.Column('duration', sa.Interval(), nullable=False),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id'], ['exercise.id'], name=op.f('fk_distance_exercise_to_id_on_exercise')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_distance_exercise'))
    )
    op.create_table('repetition_exercise',
    sa.Column('count', sa.Integer(), nullable=False),
    sa.Column('reps', sa.SmallInteger(), nullable=False),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id'], ['exercise.id'], name=op.f('fk_repetition_exercise_to_id_on_exercise')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_repetition_exercise'))
    )