"""initial

Revision ID: 24caddccb2be
Revises: 
Create Date: 2020-09-27 23:02:35.991616

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '24caddccb2be'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('jarvis_app',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('deleted_at', sa.DateTime(), nullable=True),
    sa.Column('app_name', sa.String(length=255), nullable=False),
    sa.Column('description', sa.String(length=2048), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('app_name')
    )
    op.create_table('jarvis_app_update',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('deleted_at', sa.DateTime(), nullable=True),
    sa.Column('app_id', sa.Integer(), nullable=False),
    sa.Column('app_version_id', sa.Integer(), nullable=False),
    sa.Column('is_force', sa.Boolean(), nullable=False),
    sa.Column('conditions', sa.String(length=2048), nullable=True),
    sa.Column('type', sa.SmallInteger(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_jarvis_app_update_app_id'), 'jarvis_app_update', ['app_id'], unique=False)
    op.create_index(op.f('ix_jarvis_app_update_app_version_id'), 'jarvis_app_update', ['app_version_id'], unique=False)
    op.create_table('jarvis_app_version',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
    sa.Column('deleted_at', sa.DateTime(), nullable=True),
    sa.Column('app_id', sa.Integer(), nullable=False),
    sa.Column('version', sa.String(length=32), nullable=False),
    sa.Column('version_code', sa.Integer(), nullable=False),
    sa.Column('type', sa.SmallInteger(), nullable=False),
    sa.Column('package_url', sa.String(length=1024), nullable=False),
    sa.Column('package_size', sa.Integer(), nullable=False),
    sa.Column('package_md5', sa.String(length=64), nullable=False),
    sa.Column('update_text', sa.Text(), nullable=True),
    sa.Column('update_text_en', sa.Text(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_jarvis_app_version_app_id'), 'jarvis_app_version', ['app_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_jarvis_app_version_app_id'), table_name='jarvis_app_version')
    op.drop_table('jarvis_app_version')
    op.drop_index(op.f('ix_jarvis_app_update_app_version_id'), table_name='jarvis_app_update')
    op.drop_index(op.f('ix_jarvis_app_update_app_id'), table_name='jarvis_app_update')
    op.drop_table('jarvis_app_update')
    op.drop_table('jarvis_app')
    # ### end Alembic commands ###
