"""

Revision ID: 965f54a262aa
Revises: 796e284aa6dc
Create Date: 2019-07-22 15:12:43.966888

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

# revision identifiers, used by Alembic.
revision = '965f54a262aa'
down_revision = '796e284aa6dc'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('action', 'created_at',
               existing_type=mysql.DATETIME(),
               type_=sa.DateTime(timezone=True),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('data', 'created_at',
               existing_type=mysql.DATETIME(),
               type_=sa.DateTime(timezone=True),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('data', 'updated_at',
               existing_type=mysql.DATETIME(),
               type_=sa.DateTime(timezone=True),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('ec_tokens', 'created_at',
               existing_type=mysql.DATETIME(),
               type_=sa.DateTime(timezone=True),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('ec_tokens', 'token',
               existing_type=mysql.VARCHAR(collation='utf8mb4_general_ci', length=20),
               type_=sa.String(length=32),
               existing_nullable=False)
    op.alter_column('ec_tokens', 'updated_at',
               existing_type=mysql.DATETIME(),
               type_=sa.DateTime(timezone=True),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('users', 'created_at',
               existing_type=mysql.DATETIME(),
               type_=sa.DateTime(timezone=True),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('users', 'has_avatar',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=True)
    op.alter_column('users', 'is_admin',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=True)
    op.alter_column('users', 'is_email_confirmed',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=True)
    op.alter_column('users', 'updated_at',
               existing_type=mysql.DATETIME(),
               type_=sa.DateTime(timezone=True),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users', 'updated_at',
               existing_type=sa.DateTime(timezone=True),
               type_=mysql.DATETIME(),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('users', 'is_email_confirmed',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=True)
    op.alter_column('users', 'is_admin',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=True)
    op.alter_column('users', 'has_avatar',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=True)
    op.alter_column('users', 'created_at',
               existing_type=sa.DateTime(timezone=True),
               type_=mysql.DATETIME(),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('ec_tokens', 'updated_at',
               existing_type=sa.DateTime(timezone=True),
               type_=mysql.DATETIME(),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('ec_tokens', 'token',
               existing_type=sa.String(length=32),
               type_=mysql.VARCHAR(collation='utf8mb4_general_ci', length=20),
               existing_nullable=False)
    op.alter_column('ec_tokens', 'created_at',
               existing_type=sa.DateTime(timezone=True),
               type_=mysql.DATETIME(),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('data', 'updated_at',
               existing_type=sa.DateTime(timezone=True),
               type_=mysql.DATETIME(),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('data', 'created_at',
               existing_type=sa.DateTime(timezone=True),
               type_=mysql.DATETIME(),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    op.alter_column('action', 'created_at',
               existing_type=sa.DateTime(timezone=True),
               type_=mysql.DATETIME(),
               existing_nullable=False,
               existing_server_default=sa.text('CURRENT_TIMESTAMP'))
    # ### end Alembic commands ###
