"""empty message

Revision ID: c74e764034c6
Revises: 
Create Date: 2017-11-08 17:46:29.283651

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', sa.String(length=100), nullable=False),
    sa.Column('display_name', sa.String(length=70), nullable=True),
    sa.Column('email', sa.String(length=255), nullable=False),
    sa.Column('password', sa.String(length=60), nullable=True),
    sa.Column('reset_pin', sa.SmallInteger(), server_default=sa.text(u'(0)::smallint'), nullable=False),
    sa.Column('is_banned', sa.Boolean(), server_default=sa.text(u'false'), nullable=False),
    sa.Column('is_god', sa.Boolean(), server_default=sa.text(u'false'), nullable=False),
    sa.Column('is_active', sa.Boolean(), server_default=sa.text(u'false'), nullable=False),
    sa.Column('confirmation_code', sa.String(length=255), nullable=True),
    sa.Column('last_login_location', sa.JSON(), nullable=True),
    sa.Column('is_password_change_required', sa.Boolean(), nullable=True),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text(u'now()'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('slack_id', sa.String(length=30), nullable=True),
    sa.Column('logo', sa.Text(), nullable=True),
    sa.Column('is_premium_user', sa.Boolean(), server_default=sa.text(u'false'), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email')
    )
    op.create_table('user_articles',
    sa.Column('id', sa.String(), nullable=False),
    sa.Column('user_id', sa.String(), nullable=True),
    sa.Column('feed_article_id', sa.String(), nullable=True),
    sa.Column('feed_article_title', sa.Text(), nullable=True),
    sa.Column('saved_at', sa.DateTime(), nullable=False),
    sa.Column('deleted_at', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], [u'users.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user_id', 'feed_article_id')
    )
    op.create_table('user_details',
    sa.Column('id', sa.String(), nullable=False),
    sa.Column('user_id', sa.String(length=100), nullable=False),
    sa.Column('first_name', sa.String(length=40), nullable=True),
    sa.Column('last_name', sa.String(length=40), nullable=True),
    sa.Column('country', sa.String(length=40), nullable=True),
    sa.Column('state', sa.String(length=40), nullable=True),
    sa.Column('city', sa.String(length=40), nullable=True),
    sa.Column('mobile_number', sa.String(length=15), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('location', sa.JSON(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], [u'users.id'], ondelete=u'CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user_tokens',
    sa.Column('id', sa.String(), nullable=False),
    sa.Column('user_id', sa.String(length=100), nullable=False),
    sa.Column('token', sa.String(length=100), nullable=False),
    sa.Column('expires_at', sa.DateTime(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], [u'users.id'], ondelete=u'CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user_tokens')
    op.drop_table('user_details')
    op.drop_table('user_articles')
    op.drop_table('users')
    # ### end Alembic commands ###
