"""Add fields for external apps

Revision ID: e08df0bef76f
Revises: b514cca2d47b
Create Date: 2022-09-23 16:38:06.557307

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('app', sa.Column('external', sa.Boolean(), server_default='0', nullable=False))
    op.add_column('app', sa.Column('url', sa.String(length=128), nullable=True))
    # ### end Alembic commands ###

    # Add monitoring app
    op.execute(f'INSERT IGNORE INTO app (`name`, `slug`) VALUES ("Monitoring","monitoring")')


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('app', 'url')
    op.drop_column('app', 'external')
    # ### end Alembic commands ###
