"""initial

Revision ID: b462f70d947f
Revises: 
Create Date: 2022-11-24 18:03:35.409931

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('services',
    sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('domain', sa.TEXT(), nullable=False),
    sa.Column('port', sa.INTEGER(), nullable=False),
    sa.Column('name', sa.TEXT(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('status_services',
    sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('id_service', sa.INTEGER(), nullable=True),
    sa.Column('status_code', sa.INTEGER(), nullable=False),
    sa.ForeignKeyConstraint(['id_service'], ['services.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id_service')
    )
    op.create_table('url_services',
    sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('id_service', sa.INTEGER(), nullable=True),
    sa.Column('url', sa.TEXT(), nullable=False),
    sa.ForeignKeyConstraint(['id_service'], ['services.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('url')
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('url_services')
    op.drop_table('status_services')
    op.drop_table('services')
    # ### end Alembic commands ###
