"""empty message

Revision ID: 6a2ac421f56
Revises: 18e20ed0da8d
Create Date: 2016-02-18 10:53:08.382571

"""

# revision identifiers, used by Alembic.
revision = '6a2ac421f56'
down_revision = '18e20ed0da8d'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user_device',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('device_id', sa.String(length=50), nullable=True),
    sa.Column('push_token', sa.String(length=50), nullable=True),
    sa.Column('os_version', sa.String(length=10), nullable=True),
    sa.Column('app_version', sa.String(length=10), nullable=True),
    sa.Column('device_name', sa.String(length=100), nullable=True),
    sa.Column('cat', mysql.TINYINT(display_width=1), nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=True),
    sa.Column('update_time', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('device_id')
    )
    op.create_table('user_device_log',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('device_id', sa.String(length=50), nullable=True),
    sa.Column('create_time', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_device_log_device_id'), 'user_device_log', ['device_id'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_user_device_log_device_id'), table_name='user_device_log')
    op.drop_table('user_device_log')
    op.drop_table('user_device')
    ### end Alembic commands ###
