"""Remade article to be better

Revision ID: d1a1a428aae0
Revises: 4e7b4c69111b
Create Date: 2018-10-23 22:18:11.271098

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

# revision identifiers, used by Alembic.
revision = 'd1a1a428aae0'
down_revision = '4e7b4c69111b'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('articles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(), nullable=True),
    sa.Column('url', sa.String(), nullable=True),
    sa.Column('type', sa.Enum('blog', 'workshop', name='type'), server_default='blog', nullable=False),
    sa.Column('text', sa.String(), nullable=True),
    sa.Column('creation_date', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.Column('update_date', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('title'),
    sa.UniqueConstraint('url')
    )
    op.create_table('tags',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('tag', sa.String(), nullable=False),
    sa.PrimaryKeyConstraint('id', 'tag')
    )
    op.create_table('tags_joiner',
    sa.Column('tag', sa.Integer(), nullable=False),
    sa.Column('article', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['article'], ['articles.id'], ),
    sa.ForeignKeyConstraint(['tag'], ['tags.id'], ),
    sa.PrimaryKeyConstraint('tag', 'article')
    )
    op.drop_table('article')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('article',
    sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('title', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('text', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='article_pkey'),
    sa.UniqueConstraint('title', name='article_title_key')
    )
    op.drop_table('tags_joiner')
    op.drop_table('tags')
    op.drop_table('articles')
    # ### end Alembic commands ###

Add in the migration for the previous commit
Add in the migration for the previous commit
