"""empty message

Revision ID: 46a03f51647
Revises: None
Create Date: 2015-09-27 20:56:54.697804

"""

# revision identifiers, used by Alembic.
revision = '46a03f51647'
down_revision = None

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

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('admin_user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('login', sa.String(), nullable=False),
    sa.Column('email', sa.String(), nullable=False),
    sa.Column('active', sa.Boolean(), nullable=False),
    sa.Column('password', sa.String(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('login')
    )
    op.create_table('identity',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False),
    sa.Column('custom_json', postgresql.JSONB(), server_default='{}', nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('thread',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('client_id', sa.String(), nullable=True),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False),
    sa.Column('custom_json', postgresql.JSONB(), server_default='{}', nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('client_id')
    )
    op.create_table('comment',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('identity_id', sa.Integer(), nullable=True),
    sa.Column('thread_id', sa.Integer(), nullable=False),
    sa.Column('parent_id', sa.Integer(), nullable=True),
    sa.Column('version_of_id', sa.Integer(), nullable=True),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False),
    sa.Column('modified', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False),
    sa.Column('text', sa.String(), nullable=False),
    sa.Column('custom_json', postgresql.JSONB(), server_default='{}', nullable=False),
    sa.ForeignKeyConstraint(['identity_id'], ['identity.id'], ),
    sa.ForeignKeyConstraint(['parent_id'], ['comment.id'], ),
    sa.ForeignKeyConstraint(['thread_id'], ['thread.id'], ),
    sa.ForeignKeyConstraint(['version_of_id'], ['comment.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('identity_comment',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('identity_id', sa.Integer(), nullable=False),
    sa.Column('comment_id', sa.Integer(), nullable=False),
    sa.Column('rel_type', sa.String(), nullable=False),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False),
    sa.Column('custom_json', postgresql.JSONB(), server_default='{}', nullable=False),
    sa.ForeignKeyConstraint(['comment_id'], ['comment.id'], ),
    sa.ForeignKeyConstraint(['identity_id'], ['identity.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('identity_comment')
    op.drop_table('comment')
    op.drop_table('thread')
    op.drop_table('identity')
    op.drop_table('admin_user')
    ### end Alembic commands ###
