"""Add HomeFeedForNewUser model.

Revision ID: 11e900fb08c3
Revises: 1362b0cb61b0
Create Date: 2015-07-09 15:57:06.043987

"""

# revision identifiers, used by Alembic.
revision = '11e900fb08c3'
down_revision = '1362b0cb61b0'

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('home_feed_backup',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('kind', sa.String(length=50), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('sender_id', sa.Integer(), nullable=True),
    sa.Column('question_id', sa.Integer(), nullable=True),
    sa.Column('answer_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['answer_id'], ['answer.id'], ),
    sa.ForeignKeyConstraint(['question_id'], ['question.id'], ),
    sa.ForeignKeyConstraint(['sender_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('home_feed_for_new_user')
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('home_feed_for_new_user',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('kind', mysql.VARCHAR(length=50), nullable=True),
    sa.Column('created_at', mysql.DATETIME(), nullable=True),
    sa.Column('sender_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('question_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('answer_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['answer_id'], [u'answer.id'], name=u'home_feed_for_new_user_ibfk_1'),
    sa.ForeignKeyConstraint(['question_id'], [u'question.id'], name=u'home_feed_for_new_user_ibfk_2'),
    sa.ForeignKeyConstraint(['sender_id'], [u'user.id'], name=u'home_feed_for_new_user_ibfk_3'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.drop_table('home_feed_backup')
    ### end Alembic commands ###
