"""create schema

Revision ID: 37b7d50b1512
Revises: 
Create Date: 2021-04-07 12:39:37.108568

"""
import sqlalchemy as sa
from alembic import op

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "cast_member",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.Column("modified", sa.DateTime(), nullable=True),
        sa.Column("deleted", sa.DateTime(), nullable=True),
        sa.Column("name", sa.String(length=100), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "country",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.Column("modified", sa.DateTime(), nullable=True),
        sa.Column("deleted", sa.DateTime(), nullable=True),
        sa.Column(
            "name",
            sa.Enum(
                "Afghanistan",
                "Albania",
                "Algeria",
                "Angola",
                "Argentina",
                "Armenia",
                "Australia",
                "Austria",
                "Azerbaijan",
                "Bahamas",
                "Bangladesh",
                "Belarus",
                "Belgium",
                "Bermuda",
                "Botswana",
                "Brazil",
                "Bulgaria",
                "Cambodia",
                "Canada",
                "Cayman Islands",
                "Chile",
                "China",
                "Colombia",
                "Croatia",
                "Cuba",
                "Cyprus",
                "Czech Republic",
                "Denmark",
                "Dominican Republic",
                "East Germany",
                "Ecuador",
                "Egypt",
                "Finland",
                "France",
                "Georgia",
                "Germany",
                "Ghana",
                "Greece",
                "Guatemala",
                "Hong Kong",
                "Hungary",
                "Iceland",
                "India",
                "Indonesia",
                "Iran",
                "Iraq",
                "Ireland",
                "Israel",
                "Italy",
                "Jamaica",
                "Japan",
                "Jordan",
                "Kazakhstan",
                "Kenya",
                "Kuwait",
                "Latvia",
                "Lebanon",
                "Liechtenstein",
                "Lithuania",
                "Luxembourg",
                "Malawi",
                "Malaysia",
                "Malta",
                "Mauritius",
                "Mexico",
                "Mongolia",
                "Montenegro",
                "Morocco",
                "Namibia",
                "Nepal",
                "Netherlands",
                "New Zealand",
                "Nicaragua",
                "Nigeria",
                "Norway",
                "Pakistan",
                "Panama",
                "Paraguay",
                "Peru",
                "Philippines",
                "Poland",
                "Portugal",
                "Puerto Rico",
                "Qatar",
                "Romania",
                "Russia",
                "Samoa",
                "Saudi Arabia",
                "Senegal",
                "Serbia",
                "Singapore",
                "Slovakia",
                "Slovenia",
                "Somalia",
                "South Africa",
                "South Korea",
                "Soviet Union",
                "Spain",
                "Sri Lanka",
                "Sudan",
                "Sweden",
                "Switzerland",
                "Syria",
                "Taiwan",
                "Thailand",
                "Turkey",
                "Uganda",
                "Ukraine",
                "United Arab Emirates",
                "United Kingdom",
                "United States",
                "Uruguay",
                "Vatican City",
                "Venezuela",
                "Vietnam",
                "West Germany",
                "Zimbabwe",
                name="countryenum",
            ),
            nullable=True,
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "director",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.Column("modified", sa.DateTime(), nullable=True),
        sa.Column("deleted", sa.DateTime(), nullable=True),
        sa.Column("name", sa.String(length=100), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "genre",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.Column("modified", sa.DateTime(), nullable=True),
        sa.Column("deleted", sa.DateTime(), nullable=True),
        sa.Column(
            "name",
            sa.Enum(
                "Action & Adventure",
                "Anime Features",
                "Anime Series",
                "British TV Shows",
                "Children & Family Movies",
                "Classic & Cult TV",
                "Classic Movies",
                "Comedies",
                "Crime TV Shows",
                "Cult Movies",
                "Documentaries",
                "Docuseries",
                "Dramas",
                "Faith & Spirituality",
                "Horror Movies",
                "Independent Movies",
                "International Movies",
                "International TV Shows",
                "Kids' TV",
                "Korean TV Shows",
                "LGBTQ Movies",
                "Movies",
                "Music & Musicals",
                "Reality TV",
                "Romantic Movies",
                "Romantic TV Shows",
                "Sci-Fi & Fantasy",
                "Science & Nature TV",
                "Spanish-Language TV Shows",
                "Sports Movies",
                "Stand-Up Comedy",
                "Stand-Up Comedy & Talk Shows",
                "TV Action & Adventure",
                "TV Comedies",
                "TV Dramas",
                "TV Horror",
                "TV Mysteries",
                "TV Sci-Fi & Fantasy",
                "TV Shows",
                "TV Thrillers",
                "Teen TV Shows",
                "Thrillers",
                name="genreenum",
            ),
            nullable=True,
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "netflix_title",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.Column("modified", sa.DateTime(), nullable=True),
        sa.Column("deleted", sa.DateTime(), nullable=True),
        sa.Column("netflix_show_id", sa.String(length=32), nullable=True),
        sa.Column("title_type", sa.Enum("movie", "tv_show", name="titletypeenum"), nullable=True),
        sa.Column("title", sa.String(length=200), nullable=True),
        sa.Column("netflix_date_added", sa.Date(), nullable=True),
        sa.Column("release_year", sa.Integer(), nullable=True),
        sa.Column(
            "rating",
            sa.Enum(
                "G",
                "NC-17",
                "NR",
                "PG",
                "PG-13",
                "R",
                "TV-14",
                "TV-G",
                "TV-MA",
                "TV-PG",
                "TV-Y",
                "TV-Y7",
                "TV-Y7-FV",
                "UR",
                name="ratingenum",
            ),
            nullable=True,
        ),
        sa.Column("duration", sa.Integer(), nullable=True),
        sa.Column(
            "duration_units", sa.Enum("minutes", "seasons", name="durationunitenum"), nullable=True
        ),
        sa.Column("description", sa.String(length=1000), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "cast_member_netflix_title",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.Column("modified", sa.DateTime(), nullable=True),
        sa.Column("deleted", sa.DateTime(), nullable=True),
        sa.Column("cast_member_id", sa.Integer(), nullable=True),
        sa.Column("netflix_title_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["cast_member_id"],
            ["cast_member.id"],
        ),
        sa.ForeignKeyConstraint(
            ["netflix_title_id"],
            ["netflix_title.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "country_netflix_title",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.Column("modified", sa.DateTime(), nullable=True),
        sa.Column("deleted", sa.DateTime(), nullable=True),
        sa.Column("country_id", sa.Integer(), nullable=True),
        sa.Column("netflix_title_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["country_id"],
            ["country.id"],
        ),
        sa.ForeignKeyConstraint(
            ["netflix_title_id"],
            ["netflix_title.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "director_netflix_title",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.Column("modified", sa.DateTime(), nullable=True),
        sa.Column("deleted", sa.DateTime(), nullable=True),
        sa.Column("director_id", sa.Integer(), nullable=True),
        sa.Column("netflix_title_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["director_id"],
            ["director.id"],
        ),
        sa.ForeignKeyConstraint(
            ["netflix_title_id"],
            ["netflix_title.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "genre_netflix_title",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.Column("modified", sa.DateTime(), nullable=True),
        sa.Column("deleted", sa.DateTime(), nullable=True),
        sa.Column("genre_id", sa.Integer(), nullable=True),
        sa.Column("netflix_title_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["genre_id"],
            ["genre.id"],
        ),
        sa.ForeignKeyConstraint(
            ["netflix_title_id"],
            ["netflix_title.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("genre_netflix_title")
    op.drop_table("director_netflix_title")
    op.drop_table("country_netflix_title")
    op.drop_table("cast_member_netflix_title")
    op.drop_table("netflix_title")
    op.drop_table("genre")
    op.drop_table("director")
    op.drop_table("country")
    op.drop_table("cast_member")
    # ### end Alembic commands ###
