"""empty message

Revision ID: 7450bb0ce3ff
Revises: 
Create Date: 2020-03-19 15:15:40.303871

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "apps",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.String(), nullable=True),
        sa.Column("prefix", sa.String(), nullable=True),
        sa.Column("url", sa.String(), nullable=True),
        sa.Column("icon", sa.String(), nullable=True),
        sa.Column("sidebar_icon", sa.String(), nullable=True),
        sa.Column("description", sa.String(), nullable=True),
        sa.Column("open_in", sa.String(), nullable=True),
        sa.Column("data_template", sa.String(), nullable=True),
        sa.Column("groups", sa.String(), nullable=True),
        sa.Column("tags", sa.String(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "data_sources",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.String(), nullable=True),
        sa.Column("platform", sa.String(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "files",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.String(), nullable=True),
        sa.Column("path", sa.String(), nullable=True),
        sa.Column("external_path", sa.String(), nullable=True),
        sa.Column("cache", sa.String(), nullable=True),
        sa.Column("folder", sa.String(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "groups",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.String(), nullable=True),
        sa.Column("roles", sa.String(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "settings",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("theme", sa.String(), nullable=True),
        sa.Column("accent", sa.String(), nullable=True),
        sa.Column("background", sa.String(), nullable=True),
        sa.Column("roles", sa.String(), nullable=True),
        sa.Column("home_access_groups", sa.String(), nullable=True),
        sa.Column("settings_access_groups", sa.String(), nullable=True),
        sa.Column("home_view_mode", sa.String(), nullable=True),
        sa.Column("custom_app_title", sa.String(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "tags",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.String(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "user",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("username", sa.String(length=120), nullable=False),
        sa.Column("password", sa.String(length=60), nullable=False),
        sa.Column("role", sa.String(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
        sa.UniqueConstraint("username"),
    )
    op.create_table(
        "data_sources_args",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("key", sa.String(), nullable=True),
        sa.Column("value", sa.String(), nullable=True),
        sa.Column("data_source_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(["data_source_id"], ["data_sources.id"],),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "rel_app_data_source",
        sa.Column("data_source_id", sa.Integer(), nullable=True),
        sa.Column("app_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(["app_id"], ["apps.id"],),
        sa.ForeignKeyConstraint(["data_source_id"], ["data_sources.id"],),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("rel_app_data_source")
    op.drop_table("data_sources_args")
    op.drop_table("user")
    op.drop_table("tags")
    op.drop_table("settings")
    op.drop_table("groups")
    op.drop_table("files")
    op.drop_table("data_sources")
    op.drop_table("apps")
    # ### end Alembic commands ###
