"""Add module provider redirect table

Revision ID: ff6378a8ab9d
Revises: db7a6e0d0b9d
Create Date: 2023-08-01 06:56:46.223040

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ff6378a8ab9d'
down_revision = 'db7a6e0d0b9d'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('module_provider_redirect',
    sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
    sa.Column('module', sa.String(length=128), nullable=False),
    sa.Column('provider', sa.String(length=128), nullable=False),
    sa.Column('namespace_id', sa.Integer(), nullable=False),
    sa.Column('module_provider_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['module_provider_id'], ['module_provider.id'], name='fk_module_provider_redirect_module_provider_id', onupdate='CASCADE', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['namespace_id'], ['namespace.id'], name='fk_module_provider_redirect_namespace_id', onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('module_provider_redirect')
    # ### end Alembic commands ###
