"""Add topic.wiki and TopicWikiContributor model

Revision ID: 286864df452b
Revises: 244549f21df2
Create Date: 2015-05-28 10:29:02.898775

"""

# revision identifiers, used by Alembic.
revision = '286864df452b'
down_revision = '244549f21df2'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('topic_wiki_contributor',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('count', sa.Integer(), nullable=True),
    sa.Column('last_contributed_at', sa.DateTime(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('topic_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['topic_id'], ['topic.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column(u'topic', sa.Column('wiki', sa.Text(length=4294967295), nullable=True))
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column(u'topic', 'wiki')
    op.drop_table('topic_wiki_contributor')
    ### end Alembic commands ###
