"""empty message

Revision ID: a8e18daeb3ca
Revises: 
Create Date: 2020-11-23 18:16:28.934687

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a8e18daeb3ca'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('about_service',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('image_path', sa.String(), nullable=True),
    sa.Column('description', sa.String(length=5000), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('category',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=100), nullable=False),
    sa.Column('parent_id', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('charities',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=200), nullable=False),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('description', sa.String(length=5000), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('chat_room',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('reason_close',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=200), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('support',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('image_path', sa.String(), nullable=True),
    sa.Column('description', sa.String(length=5000), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('type_close',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=200), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=200), nullable=False),
    sa.Column('password', sa.String(length=200), nullable=False),
    sa.Column('date_registration', sa.DateTime(), nullable=True),
    sa.Column('have_personal_area', sa.Boolean(), nullable=False),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('token', sa.String(length=500), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('charities_address',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('address', sa.String(length=500), nullable=False),
    sa.Column('id_charities', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_charities'], ['charities.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('charities_contacts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('contact', sa.String(length=500), nullable=False),
    sa.Column('id_charities', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_charities'], ['charities.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('charities_social_networks',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('social_networks', sa.String(length=500), nullable=False),
    sa.Column('id_charities', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_charities'], ['charities.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('chat_message',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('message', sa.String(length=5000), nullable=False),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('id_user', sa.Integer(), nullable=False),
    sa.Column('id_chat_room', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_chat_room'], ['chat_room.id'], ),
    sa.ForeignKeyConstraint(['id_user'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('chat_users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('chat_name', sa.String(length=200), nullable=True),
    sa.Column('id_sender', sa.Integer(), nullable=False),
    sa.Column('id_addressee', sa.Integer(), nullable=False),
    sa.Column('id_chat_room', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_chat_room'], ['chat_room.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('closed',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('type', sa.Integer(), nullable=False),
    sa.Column('reason', sa.Integer(), nullable=False),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.ForeignKeyConstraint(['reason'], ['reason_close.id'], ),
    sa.ForeignKeyConstraint(['type'], ['type_close.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('images_charities',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('image_path', sa.String(), nullable=True),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('id_charities', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_charities'], ['charities.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id_charities')
    )
    op.create_table('personal_area',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('surname', sa.String(length=100), nullable=False),
    sa.Column('name', sa.String(length=100), nullable=False),
    sa.Column('patronymic', sa.String(length=100), nullable=True),
    sa.Column('phone_number', sa.String(length=20), nullable=True),
    sa.Column('email', sa.String(length=100), nullable=True),
    sa.Column('geolocation', sa.String(length=200), nullable=True),
    sa.Column('id_user', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_user'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('id_user'),
    sa.UniqueConstraint('phone_number')
    )
    op.create_table('reference',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('id_charities', sa.Integer(), nullable=False),
    sa.Column('id_support', sa.Integer(), nullable=False),
    sa.Column('id_about_service', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_about_service'], ['about_service.id'], ),
    sa.ForeignKeyConstraint(['id_charities'], ['charities.id'], ),
    sa.ForeignKeyConstraint(['id_support'], ['support.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id_about_service'),
    sa.UniqueConstraint('id_charities'),
    sa.UniqueConstraint('id_support')
    )
    op.create_table('users_social',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('social_id', sa.String(length=200), nullable=False),
    sa.Column('id_user', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_user'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id_user'),
    sa.UniqueConstraint('social_id')
    )
    op.create_table('announcement',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=100), nullable=False),
    sa.Column('description', sa.String(length=5000), nullable=False),
    sa.Column('saled', sa.Boolean(), nullable=True),
    sa.Column('category', sa.Integer(), nullable=False),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('reason_id', sa.Integer(), nullable=True),
    sa.Column('user', sa.Integer(), nullable=False),
    sa.Column('city', sa.String(length=200), nullable=True),
    sa.Column('address', sa.String(length=500), nullable=True),
    sa.Column('delete', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['category'], ['category.id'], ),
    sa.ForeignKeyConstraint(['reason_id'], ['closed.id'], ),
    sa.ForeignKeyConstraint(['user'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('images_personal_area',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('image_path', sa.String(), nullable=True),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('id_personal_area', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_personal_area'], ['personal_area.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id_personal_area')
    )
    op.create_table('images_announ',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('image_path', sa.String(), nullable=True),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('announcement', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['announcement'], ['announcement.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('recently_viewed',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user', sa.Integer(), nullable=False),
    sa.Column('announcement', sa.Integer(), nullable=False),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.ForeignKeyConstraint(['announcement'], ['announcement.id'], ),
    sa.ForeignKeyConstraint(['user'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('want',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('announcement', sa.Integer(), nullable=False),
    sa.Column('category', sa.Integer(), nullable=False),
    sa.Column('str_want', sa.String(length=300), nullable=True),
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.ForeignKeyConstraint(['announcement'], ['announcement.id'], ),
    sa.ForeignKeyConstraint(['category'], ['category.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('want')
    op.drop_table('recently_viewed')
    op.drop_table('images_announ')
    op.drop_table('images_personal_area')
    op.drop_table('announcement')
    op.drop_table('users_social')
    op.drop_table('reference')
    op.drop_table('personal_area')
    op.drop_table('images_charities')
    op.drop_table('closed')
    op.drop_table('chat_users')
    op.drop_table('chat_message')
    op.drop_table('charities_social_networks')
    op.drop_table('charities_contacts')
    op.drop_table('charities_address')
    op.drop_table('users')
    op.drop_table('type_close')
    op.drop_table('support')
    op.drop_table('reason_close')
    op.drop_table('chat_room')
    op.drop_table('charities')
    op.drop_table('category')
    op.drop_table('about_service')
    # ### end Alembic commands ###
