"""recreate_user_table

Revision ID: d0d0a83c8d17
Revises: e41434540dca
Create Date: 2017-01-06 13:03:07.137119

"""

# revision identifiers, used by Alembic.
revision = 'd0d0a83c8d17'
down_revision = 'e41434540dca'

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

def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('eve_user')
    op.create_table('eve_user',
    sa.Column('character_id', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('character_owner_hash', sa.String(length=255), nullable=True),
    sa.Column('character_name', sa.String(length=200), nullable=True),
    sa.Column('access_token', sa.String(length=100), nullable=True),
    sa.Column('access_token_expires', sa.DateTime(timezone=True), nullable=True),
    sa.Column('refresh_token', sa.String(length=100), nullable=True),
    sa.Column('main_character_id', sa.BigInteger(), nullable=True))
    
    sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text(u'now()'), nullable=True),
    sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text(u'now()'), nullable=True),
    sa.PrimaryKeyConstraint('character_id')

    op.create_foreign_key(None, 'eve_user', 'item', ['main_character_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('eve_user')
    op.create_table('eve_user',
    sa.Column('character_id', sa.Integer(), autoincrement=False, nullable=False),
    sa.Column('character_owner_hash', sa.String(length=255), nullable=True),
    sa.Column('character_name', sa.String(length=200), nullable=True),
    sa.Column('scopes', sa.String(length=200), nullable=True),
    sa.Column('token_type', sa.String(length=20), nullable=True),
    sa.Column('access_token', sa.String(length=100), nullable=True),
    sa.Column('access_token_expires', sa.DateTime(timezone=True), nullable=True),
    sa.Column('refresh_token', sa.String(length=100), nullable=True),
    sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text(u'now()'), nullable=True),
    sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text(u'now()'), nullable=True),
    sa.PrimaryKeyConstraint('character_id')
    # ### end Alembic commands ###

"""recreate_user_table

Revision ID: d0d0a83c8d17
Revises: e41434540dca
Create Date: 2017-01-06 13:03:07.137119

"""

# revision identifiers, used by Alembic.
revision = 'd0d0a83c8d17'
down_revision = 'e41434540dca'

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

def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('eve_user')
    op.create_table('eve_user',
    sa.Column('character_id', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('character_owner_hash', sa.String(length=255), nullable=True),
    sa.Column('character_name', sa.String(length=200), nullable=True),
    sa.Column('access_token', sa.String(length=100), nullable=True),
    sa.Column('access_token_expires', sa.DateTime(timezone=True), nullable=True),
    sa.Column('refresh_token', sa.String(length=100), nullable=True),
    sa.Column('main_character_id', sa.BigInteger(), nullable=True))
    
    sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text(u'now()'), nullable=True),
    sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text(u'now()'), nullable=True),
    sa.PrimaryKeyConstraint('character_id')
    )
    op.create_foreign_key(None, 'eve_user', 'item', ['main_character_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('eve_user')
    op.create_table('eve_user',
    sa.Column('character_id', sa.Integer(), autoincrement=False, nullable=False),
    sa.Column('character_owner_hash', sa.String(length=255), nullable=True),
    sa.Column('character_name', sa.String(length=200), nullable=True),
    sa.Column('scopes', sa.String(length=200), nullable=True),
    sa.Column('token_type', sa.String(length=20), nullable=True),
    sa.Column('access_token', sa.String(length=100), nullable=True),
    sa.Column('access_token_expires', sa.DateTime(timezone=True), nullable=True),
    sa.Column('refresh_token', sa.String(length=100), nullable=True),
    sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text(u'now()'), nullable=True),
    sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text(u'now()'), nullable=True),
    sa.PrimaryKeyConstraint('character_id')
    )
    # ### end Alembic commands ###

add missing )