"""Fix many bugs

Revision ID: bde8e3e10549
Revises: 61ac4a468799
Create Date: 2020-03-14 22:56:44.565420

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

# revision identifiers, used by Alembic.
revision = 'bde8e3e10549'
down_revision = '61ac4a468799'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('channels', sa.Column('count_of_publications', sa.Integer(), nullable=True))
    op.add_column('channels', sa.Column('end_time_publications', sa.Time(), nullable=True))
    op.add_column('channels', sa.Column('start_time_publications', sa.Time(), nullable=True))
    op.add_column('donors', sa.Column('channel_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'donors', 'channels', ['channel_id'], ['id'])
    op.add_column('posts', sa.Column('video', sa.ARRAY(sa.String()), nullable=True))
    op.drop_column('posts', 'Video')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('posts', sa.Column('Video', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True))
    op.drop_column('posts', 'video')
    op.drop_constraint(None, 'donors', type_='foreignkey')
    op.drop_column('donors', 'channel_id')
    op.drop_column('channels', 'start_time_publications')
    op.drop_column('channels', 'end_time_publications')
    op.drop_column('channels', 'count_of_publications')
    # ### end Alembic commands ###
