Upgrade black
This commit is contained in:
parent
fad875b332
commit
dbdce83067
5 changed files with 1208 additions and 914 deletions
|
|
@ -78,7 +78,8 @@ def upgrade():
|
|||
name=op.f('ck_couriers_on_realistic_pay_per_order'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'0 <= speed AND speed <= 30', name=op.f('ck_couriers_on_realistic_speed'),
|
||||
'0 <= speed AND speed <= 30',
|
||||
name=op.f('ck_couriers_on_realistic_speed'),
|
||||
),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_couriers')),
|
||||
*(
|
||||
|
|
@ -124,7 +125,8 @@ def upgrade():
|
|||
name=op.f('ck_addresses_on_latitude_between_90_degrees'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'0 <= floor AND floor <= 40', name=op.f('ck_addresses_on_realistic_floor'),
|
||||
'0 <= floor AND floor <= 40',
|
||||
name=op.f('ck_addresses_on_realistic_floor'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'30000 <= zip_code AND zip_code <= 99999',
|
||||
|
|
@ -378,7 +380,8 @@ def upgrade():
|
|||
name=op.f('ck_orders_on_ordered_timestamps_19'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'cancelled_at > pickup_at', name=op.f('ck_orders_on_ordered_timestamps_18'),
|
||||
'cancelled_at > pickup_at',
|
||||
name=op.f('ck_orders_on_ordered_timestamps_18'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'cancelled_at > reached_delivery_at',
|
||||
|
|
@ -457,7 +460,8 @@ def upgrade():
|
|||
name=op.f('ck_orders_on_ordered_timestamps_29'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'dispatch_at < pickup_at', name=op.f('ck_orders_on_ordered_timestamps_28'),
|
||||
'dispatch_at < pickup_at',
|
||||
name=op.f('ck_orders_on_ordered_timestamps_28'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'dispatch_at < reached_delivery_at',
|
||||
|
|
@ -484,7 +488,8 @@ def upgrade():
|
|||
name=op.f('ck_orders_on_ordered_timestamps_50'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'pickup_at < delivery_at', name=op.f('ck_orders_on_ordered_timestamps_49'),
|
||||
'pickup_at < delivery_at',
|
||||
name=op.f('ck_orders_on_ordered_timestamps_49'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'pickup_at < left_pickup_at',
|
||||
|
|
@ -495,7 +500,8 @@ def upgrade():
|
|||
name=op.f('ck_orders_on_ordered_timestamps_48'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'placed_at < cancelled_at', name=op.f('ck_orders_on_ordered_timestamps_2'),
|
||||
'placed_at < cancelled_at',
|
||||
name=op.f('ck_orders_on_ordered_timestamps_2'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'placed_at < courier_accepted_at',
|
||||
|
|
@ -506,10 +512,12 @@ def upgrade():
|
|||
name=op.f('ck_orders_on_ordered_timestamps_6'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'placed_at < delivery_at', name=op.f('ck_orders_on_ordered_timestamps_11'),
|
||||
'placed_at < delivery_at',
|
||||
name=op.f('ck_orders_on_ordered_timestamps_11'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'placed_at < dispatch_at', name=op.f('ck_orders_on_ordered_timestamps_5'),
|
||||
'placed_at < dispatch_at',
|
||||
name=op.f('ck_orders_on_ordered_timestamps_5'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'placed_at < first_estimated_delivery_at',
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ def upgrade():
|
|||
ondelete='RESTRICT',
|
||||
),
|
||||
sa.UniqueConstraint(
|
||||
'city_id', 'side_length', name=op.f('uq_grids_on_city_id_side_length'),
|
||||
'city_id',
|
||||
'side_length',
|
||||
name=op.f('uq_grids_on_city_id_side_length'),
|
||||
),
|
||||
# This `UniqueConstraint` is needed by the `addresses_pixels` table below.
|
||||
sa.UniqueConstraint('id', 'city_id', name=op.f('uq_grids_on_id_city_id')),
|
||||
|
|
@ -61,7 +63,10 @@ def upgrade():
|
|||
),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_pixels')),
|
||||
sa.UniqueConstraint(
|
||||
'grid_id', 'n_x', 'n_y', name=op.f('uq_pixels_on_grid_id_n_x_n_y'),
|
||||
'grid_id',
|
||||
'n_x',
|
||||
'n_y',
|
||||
name=op.f('uq_pixels_on_grid_id_n_x_n_y'),
|
||||
),
|
||||
sa.UniqueConstraint('id', 'grid_id', name=op.f('uq_pixels_on_id_grid_id')),
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
|
|
@ -134,7 +139,9 @@ def upgrade():
|
|||
ondelete='RESTRICT',
|
||||
),
|
||||
sa.PrimaryKeyConstraint(
|
||||
'address_id', 'pixel_id', name=op.f('pk_addresses_pixels'),
|
||||
'address_id',
|
||||
'pixel_id',
|
||||
name=op.f('pk_addresses_pixels'),
|
||||
),
|
||||
sa.UniqueConstraint(
|
||||
'address_id',
|
||||
|
|
@ -155,13 +162,19 @@ def downgrade():
|
|||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.drop_index(
|
||||
op.f('ix_pixels_on_n_y'), table_name='pixels', schema=config.CLEAN_SCHEMA,
|
||||
op.f('ix_pixels_on_n_y'),
|
||||
table_name='pixels',
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.drop_index(
|
||||
op.f('ix_pixels_on_n_x'), table_name='pixels', schema=config.CLEAN_SCHEMA,
|
||||
op.f('ix_pixels_on_n_x'),
|
||||
table_name='pixels',
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.drop_index(
|
||||
op.f('ix_pixels_on_grid_id'), table_name='pixels', schema=config.CLEAN_SCHEMA,
|
||||
op.f('ix_pixels_on_grid_id'),
|
||||
table_name='pixels',
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.drop_table('pixels', schema=config.CLEAN_SCHEMA)
|
||||
op.drop_table('grids', schema=config.CLEAN_SCHEMA)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ def upgrade():
|
|||
name=op.f('ck_forecasts_on_start_at_allows_no_seconds'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'time_step > 0', name=op.f('ck_forecasts_on_time_step_must_be_positive'),
|
||||
'time_step > 0',
|
||||
name=op.f('ck_forecasts_on_time_step_must_be_positive'),
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
'training_horizon > 0',
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@ config = configuration.make_config('testing' if os.getenv('TESTING') else 'produ
|
|||
def upgrade():
|
||||
"""Upgrade to revision 26711cd3f9b9."""
|
||||
op.alter_column(
|
||||
'forecasts', 'method', new_column_name='model', schema=config.CLEAN_SCHEMA,
|
||||
'forecasts',
|
||||
'method',
|
||||
new_column_name='model',
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.add_column(
|
||||
'forecasts',
|
||||
|
|
@ -108,17 +111,28 @@ def upgrade():
|
|||
def downgrade():
|
||||
"""Downgrade to revision e40623e10405."""
|
||||
op.alter_column(
|
||||
'forecasts', 'model', new_column_name='method', schema=config.CLEAN_SCHEMA,
|
||||
'forecasts',
|
||||
'model',
|
||||
new_column_name='method',
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.drop_column(
|
||||
'forecasts', 'low80', schema=config.CLEAN_SCHEMA,
|
||||
'forecasts',
|
||||
'low80',
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.drop_column(
|
||||
'forecasts', 'high80', schema=config.CLEAN_SCHEMA,
|
||||
'forecasts',
|
||||
'high80',
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.drop_column(
|
||||
'forecasts', 'low95', schema=config.CLEAN_SCHEMA,
|
||||
'forecasts',
|
||||
'low95',
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.drop_column(
|
||||
'forecasts', 'high95', schema=config.CLEAN_SCHEMA,
|
||||
'forecasts',
|
||||
'high95',
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -113,7 +113,9 @@ def upgrade():
|
|||
sa.Column('reached_delivery_at', sa.DateTime),
|
||||
sa.Column('delivery_at', sa.DateTime),
|
||||
sa.PrimaryKeyConstraint(
|
||||
'simulation_id', 'actual_order_id', name=op.f('pk_replayed_orders'),
|
||||
'simulation_id',
|
||||
'actual_order_id',
|
||||
name=op.f('pk_replayed_orders'),
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
['simulation_id'],
|
||||
|
|
@ -296,7 +298,8 @@ def upgrade():
|
|||
),
|
||||
*(
|
||||
sa.CheckConstraint(
|
||||
constraint, name='ordered_timestamps_{index}'.format(index=index),
|
||||
constraint,
|
||||
name='ordered_timestamps_{index}'.format(index=index),
|
||||
)
|
||||
for index, constraint in enumerate(
|
||||
(
|
||||
|
|
@ -390,7 +393,10 @@ def downgrade():
|
|||
op.drop_table('replayed_orders', schema=config.CLEAN_SCHEMA)
|
||||
op.drop_table('replay_simulations', schema=config.CLEAN_SCHEMA)
|
||||
op.drop_constraint(
|
||||
'uq_orders_on_id_ad_hoc', 'orders', type_=None, schema=config.CLEAN_SCHEMA,
|
||||
'uq_orders_on_id_ad_hoc',
|
||||
'orders',
|
||||
type_=None,
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
op.execute(
|
||||
f"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue