"""init

Revision ID: fb8ce6ce7c6b
Revises: 
Create Date: 2021-11-27 16:52:18.035895

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


# revision identifiers, used by Alembic.
revision = "fb8ce6ce7c6b"
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "appid_error",
        sa.Column("pk", sa.Integer(), nullable=True),
        sa.Column("appid", sa.Integer(), nullable=False),
        sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
        sa.Column("reason", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
        sa.PrimaryKeyConstraint("pk"),
        sa.UniqueConstraint("appid"),
    )
    op.create_table(
        "category",
        sa.Column("pk", sa.Integer(), nullable=True),
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column(
            "description", sqlmodel.sql.sqltypes.AutoString(), nullable=False
        ),
        sa.PrimaryKeyConstraint("pk"),
    )
    op.create_table(
        "genre",
        sa.Column("pk", sa.Integer(), nullable=True),
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column(
            "description", sqlmodel.sql.sqltypes.AutoString(), nullable=False
        ),
        sa.PrimaryKeyConstraint("pk"),
    )
    op.create_table(
        "steam_app",
        sa.Column("pk", sa.Integer(), nullable=True),
        sa.Column("appid", sa.Integer(), nullable=False),
        sa.Column("type", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
        sa.Column("is_free", sa.Boolean(), nullable=True),
        sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.Column(
            "controller_support",
            sqlmodel.sql.sqltypes.AutoString(),
            nullable=True,
        ),
        sa.Column("metacritic_score", sa.Integer(), nullable=True),
        sa.Column(
            "metacritic_url", sqlmodel.sql.sqltypes.AutoString(), nullable=True
        ),
        sa.Column("recommendations", sa.Integer(), nullable=True),
        sa.Column("achievements_total", sa.Integer(), nullable=True),
        sa.Column("release_date", sa.Date(), nullable=True),
        sa.Column("created", sa.DateTime(), nullable=False),
        sa.Column("updated", sa.DateTime(), nullable=False),
        sa.PrimaryKeyConstraint("pk"),
    )
    op.create_index(
        op.f("ix_steam_app_appid"), "steam_app", ["appid"], unique=True
    )
    op.create_index(
        op.f("ix_steam_app_name"), "steam_app", ["name"], unique=False
    )
    op.create_table(
        "achievement",
        sa.Column("pk", sa.Integer(), nullable=True),
        sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.Column("percent", sa.Float(), nullable=False),
        sa.Column("steam_app_pk", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["steam_app_pk"],
            ["steam_app.pk"],
        ),
        sa.PrimaryKeyConstraint("pk"),
    )
    op.create_table(
        "categorysteamapplink",
        sa.Column("category_pk", sa.Integer(), nullable=True),
        sa.Column("steam_app_pk", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["category_pk"],
            ["category.pk"],
        ),
        sa.ForeignKeyConstraint(
            ["steam_app_pk"],
            ["steam_app.pk"],
        ),
        sa.PrimaryKeyConstraint("category_pk", "steam_app_pk"),
    )
    op.create_table(
        "genresteammapplink",
        sa.Column("genre_pk", sa.Integer(), nullable=True),
        sa.Column("steam_app_pk", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["genre_pk"],
            ["genre.pk"],
        ),
        sa.ForeignKeyConstraint(
            ["steam_app_pk"],
            ["steam_app.pk"],
        ),
        sa.PrimaryKeyConstraint("genre_pk", "steam_app_pk"),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("genresteammapplink")
    op.drop_table("categorysteamapplink")
    op.drop_table("achievement")
    op.drop_index(op.f("ix_steam_app_name"), table_name="steam_app")
    op.drop_index(op.f("ix_steam_app_appid"), table_name="steam_app")
    op.drop_table("steam_app")
    op.drop_table("genre")
    op.drop_table("category")
    op.drop_table("appid_error")
    # ### end Alembic commands ###

alembic.op.drop_table sqlalchemy.DateTime sqlalchemy.Float sqlalchemy.Date alembic.op.f sqlmodel.sql.sqltypes.AutoString sqlalchemy.PrimaryKeyConstraint sqlalchemy.Boolean sqlalchemy.UniqueConstraint sqlalchemy.ForeignKeyConstraint sqlalchemy.Integer
[((4084, 4119), 'alembic.op.drop_table', 'op.drop_table', (['"""genresteammapplink"""'], {}), "('genresteammapplink')\n", (4097, 4119), False, 'from alembic import op\n'), ((4124, 4161), 'alembic.op.drop_table', 'op.drop_table', (['"""categorysteamapplink"""'], {}), "('categorysteamapplink')\n", (4137, 4161), False, 'from alembic import op\n'), ((4166, 4194), 'alembic.op.drop_table', 'op.drop_table', (['"""achievement"""'], {}), "('achievement')\n", (4179, 4194), False, 'from alembic import op\n'), ((4338, 4364), 'alembic.op.drop_table', 'op.drop_table', (['"""steam_app"""'], {}), "('steam_app')\n", (4351, 4364), False, 'from alembic import op\n'), ((4369, 4391), 'alembic.op.drop_table', 'op.drop_table', (['"""genre"""'], {}), "('genre')\n", (4382, 4391), False, 'from alembic import op\n'), ((4396, 4421), 'alembic.op.drop_table', 'op.drop_table', (['"""category"""'], {}), "('category')\n", (4409, 4421), False, 'from alembic import op\n'), ((4426, 4454), 'alembic.op.drop_table', 'op.drop_table', (['"""appid_error"""'], {}), "('appid_error')\n", (4439, 4454), False, 'from alembic import op\n'), ((687, 716), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""pk"""'], {}), "('pk')\n", (710, 716), True, 'import sqlalchemy as sa\n'), ((726, 754), 'sqlalchemy.UniqueConstraint', 'sa.UniqueConstraint', (['"""appid"""'], {}), "('appid')\n", (745, 754), True, 'import sqlalchemy as sa\n'), ((1028, 1057), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""pk"""'], {}), "('pk')\n", (1051, 1057), True, 'import sqlalchemy as sa\n'), ((1328, 1357), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""pk"""'], {}), "('pk')\n", (1351, 1357), True, 'import sqlalchemy as sa\n'), ((2380, 2409), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""pk"""'], {}), "('pk')\n", (2403, 2409), True, 'import sqlalchemy as sa\n'), ((2446, 2472), 'alembic.op.f', 'op.f', (['"""ix_steam_app_appid"""'], {}), "('ix_steam_app_appid')\n", (2450, 2472), False, 'from alembic import op\n'), ((2545, 2570), 'alembic.op.f', 'op.f', (['"""ix_steam_app_name"""'], {}), "('ix_steam_app_name')\n", (2549, 2570), False, 'from alembic import op\n'), ((2921, 2980), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['steam_app_pk']", "['steam_app.pk']"], {}), "(['steam_app_pk'], ['steam_app.pk'])\n", (2944, 2980), True, 'import sqlalchemy as sa\n'), ((3025, 3054), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""pk"""'], {}), "('pk')\n", (3048, 3054), True, 'import sqlalchemy as sa\n'), ((3250, 3307), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['category_pk']", "['category.pk']"], {}), "(['category_pk'], ['category.pk'])\n", (3273, 3307), True, 'import sqlalchemy as sa\n'), ((3352, 3411), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['steam_app_pk']", "['steam_app.pk']"], {}), "(['steam_app_pk'], ['steam_app.pk'])\n", (3375, 3411), True, 'import sqlalchemy as sa\n'), ((3456, 3510), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""category_pk"""', '"""steam_app_pk"""'], {}), "('category_pk', 'steam_app_pk')\n", (3479, 3510), True, 'import sqlalchemy as sa\n'), ((3701, 3752), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['genre_pk']", "['genre.pk']"], {}), "(['genre_pk'], ['genre.pk'])\n", (3724, 3752), True, 'import sqlalchemy as sa\n'), ((3797, 3856), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['steam_app_pk']", "['steam_app.pk']"], {}), "(['steam_app_pk'], ['steam_app.pk'])\n", (3820, 3856), True, 'import sqlalchemy as sa\n'), ((3901, 3952), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""genre_pk"""', '"""steam_app_pk"""'], {}), "('genre_pk', 'steam_app_pk')\n", (3924, 3952), True, 'import sqlalchemy as sa\n'), ((4213, 4238), 'alembic.op.f', 'op.f', (['"""ix_steam_app_name"""'], {}), "('ix_steam_app_name')\n", (4217, 4238), False, 'from alembic import op\n'), ((4282, 4308), 'alembic.op.f', 'op.f', (['"""ix_steam_app_appid"""'], {}), "('ix_steam_app_appid')\n", (4286, 4308), False, 'from alembic import op\n'), ((433, 445), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (443, 445), True, 'import sqlalchemy as sa\n'), ((490, 502), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (500, 502), True, 'import sqlalchemy as sa\n'), ((547, 581), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (579, 581), False, 'import sqlmodel\n'), ((627, 661), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (659, 661), False, 'import sqlmodel\n'), ((827, 839), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (837, 839), True, 'import sqlalchemy as sa\n'), ((881, 893), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (891, 893), True, 'import sqlalchemy as sa\n'), ((958, 992), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (990, 992), False, 'import sqlmodel\n'), ((1127, 1139), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (1137, 1139), True, 'import sqlalchemy as sa\n'), ((1181, 1193), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (1191, 1193), True, 'import sqlalchemy as sa\n'), ((1258, 1292), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1290, 1292), False, 'import sqlmodel\n'), ((1431, 1443), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (1441, 1443), True, 'import sqlalchemy as sa\n'), ((1488, 1500), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (1498, 1500), True, 'import sqlalchemy as sa\n'), ((1545, 1579), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1577, 1579), False, 'import sqlmodel\n'), ((1626, 1638), 'sqlalchemy.Boolean', 'sa.Boolean', ([], {}), '()\n', (1636, 1638), True, 'import sqlalchemy as sa\n'), ((1682, 1716), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1714, 1716), False, 'import sqlmodel\n'), ((1800, 1834), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1832, 1834), False, 'import sqlmodel\n'), ((1912, 1924), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (1922, 1924), True, 'import sqlalchemy as sa\n'), ((1991, 2025), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (2023, 2025), False, 'import sqlmodel\n'), ((2089, 2101), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (2099, 2101), True, 'import sqlalchemy as sa\n'), ((2159, 2171), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (2169, 2171), True, 'import sqlalchemy as sa\n'), ((2223, 2232), 'sqlalchemy.Date', 'sa.Date', ([], {}), '()\n', (2230, 2232), True, 'import sqlalchemy as sa\n'), ((2279, 2292), 'sqlalchemy.DateTime', 'sa.DateTime', ([], {}), '()\n', (2290, 2292), True, 'import sqlalchemy as sa\n'), ((2340, 2353), 'sqlalchemy.DateTime', 'sa.DateTime', ([], {}), '()\n', (2351, 2353), True, 'import sqlalchemy as sa\n'), ((2682, 2694), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (2692, 2694), True, 'import sqlalchemy as sa\n'), ((2738, 2772), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (2770, 2772), False, 'import sqlmodel\n'), ((2820, 2830), 'sqlalchemy.Float', 'sa.Float', ([], {}), '()\n', (2828, 2830), True, 'import sqlalchemy as sa\n'), ((2883, 2895), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (2893, 2895), True, 'import sqlalchemy as sa\n'), ((3148, 3160), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (3158, 3160), True, 'import sqlalchemy as sa\n'), ((3212, 3224), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (3222, 3224), True, 'import sqlalchemy as sa\n'), ((3599, 3611), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (3609, 3611), True, 'import sqlalchemy as sa\n'), ((3663, 3675), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (3673, 3675), True, 'import sqlalchemy as sa\n')]