"""Add countries

Revision ID: <KEY>
Revises: 423e059e8b64
Create Date: 2022-02-12 07:51:13.003045+00:00

"""
import sqlalchemy as sa
import sqlmodel
from alembic import op

# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "423e059e8b64"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "countries",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.PrimaryKeyConstraint("id"),
    )
    op.add_column("applications", sa.Column("country_id", sa.Integer(), nullable=False))
    op.create_foreign_key(None, "applications", "countries", ["country_id"], ["id"])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "applications", type_="foreignkey")
    op.drop_column("applications", "country_id")
    op.drop_table("countries")
    # ### end Alembic commands ###

sqlmodel.sql.sqltypes.AutoString alembic.op.create_foreign_key sqlalchemy.Integer alembic.op.drop_table sqlalchemy.PrimaryKeyConstraint alembic.op.drop_constraint alembic.op.drop_column
[((701, 786), 'alembic.op.create_foreign_key', 'op.create_foreign_key', (['None', '"""applications"""', '"""countries"""', "['country_id']", "['id']"], {}), "(None, 'applications', 'countries', ['country_id'], ['id']\n    )\n", (722, 786), False, 'from alembic import op\n'), ((906, 966), 'alembic.op.drop_constraint', 'op.drop_constraint', (['None', '"""applications"""'], {'type_': '"""foreignkey"""'}), "(None, 'applications', type_='foreignkey')\n", (924, 966), False, 'from alembic import op\n'), ((971, 1015), 'alembic.op.drop_column', 'op.drop_column', (['"""applications"""', '"""country_id"""'], {}), "('applications', 'country_id')\n", (985, 1015), False, 'from alembic import op\n'), ((1020, 1046), 'alembic.op.drop_table', 'op.drop_table', (['"""countries"""'], {}), "('countries')\n", (1033, 1046), False, 'from alembic import op\n'), ((571, 600), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (594, 600), True, 'import sqlalchemy as sa\n'), ((453, 465), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (463, 465), True, 'import sqlalchemy as sa\n'), ((510, 544), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (542, 544), False, 'import sqlmodel\n'), ((666, 678), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (676, 678), True, 'import sqlalchemy as sa\n')]