<gh_stars>1-10
"""add restaurant_courier table

Revision ID: 2175eaddb802
Revises: <KEY>
Create Date: 2021-03-26 15:56:56.884843

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '2175eaddb802'
down_revision = '<KEY>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('restaurant_courier',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('restaurant_id', sa.Integer(), nullable=False),
    sa.Column('courier_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['courier_id'], ['courier.id'], ),
    sa.ForeignKeyConstraint(['restaurant_id'], ['restaurant.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_restaurant_courier_courier_id'), 'restaurant_courier', ['courier_id'], unique=False)
    op.create_index(op.f('ix_restaurant_courier_restaurant_id'), 'restaurant_courier', ['restaurant_id'], unique=False)
    op.drop_table('restaurant_couriers')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('restaurant_couriers',
    sa.Column('restaurant_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('courier_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['courier_id'], ['courier.id'], name='restaurant_couriers_courier_id_fkey'),
    sa.ForeignKeyConstraint(['restaurant_id'], ['restaurant.id'], name='restaurant_couriers_restaurant_id_fkey'),
    sa.PrimaryKeyConstraint('restaurant_id', 'courier_id', name='restaurant_couriers_pkey')
    )
    op.drop_index(op.f('ix_restaurant_courier_restaurant_id'), table_name='restaurant_courier')
    op.drop_index(op.f('ix_restaurant_courier_courier_id'), table_name='restaurant_courier')
    op.drop_table('restaurant_courier')
    # ### end Alembic commands ###

"""add restaurant_courier table

Revision ID: 2175eaddb802
Revises: <KEY>
Create Date: 2021-03-26 15:56:56.884843

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '2175eaddb802'
down_revision = '<KEY>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('restaurant_courier',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('restaurant_id', sa.Integer(), nullable=False),
    sa.Column('courier_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['courier_id'], ['courier.id'], ),
    sa.ForeignKeyConstraint(['restaurant_id'], ['restaurant.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_restaurant_courier_courier_id'), 'restaurant_courier', ['courier_id'], unique=False)
    op.create_index(op.f('ix_restaurant_courier_restaurant_id'), 'restaurant_courier', ['restaurant_id'], unique=False)
    op.drop_table('restaurant_couriers')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('restaurant_couriers',
    sa.Column('restaurant_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('courier_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['courier_id'], ['courier.id'], name='restaurant_couriers_courier_id_fkey'),
    sa.ForeignKeyConstraint(['restaurant_id'], ['restaurant.id'], name='restaurant_couriers_restaurant_id_fkey'),
    sa.PrimaryKeyConstraint('restaurant_id', 'courier_id', name='restaurant_couriers_pkey')
    )
    op.drop_index(op.f('ix_restaurant_courier_restaurant_id'), table_name='restaurant_courier')
    op.drop_index(op.f('ix_restaurant_courier_courier_id'), table_name='restaurant_courier')
    op.drop_table('restaurant_courier')
    # ### end Alembic commands ###
add restaurant_courier table  Revision ID: 2175eaddb802 Revises: <KEY> Create Date: 2021-03-26 15:56:56.884843 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###