"""Add example models

Revision ID: c9c192bde160
Revises: 
Create Date: 2019-03-31 07:42:12.476793
"""

from alembic import op
import sqlalchemy as sa
import backend


# revision identifiers, used by Alembic.
revision = 'c9c192bde160'
down_revision = None
branch_labels = ('example',)
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('category',
    sa.Column('created_at', backend.database.types.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated_at', backend.database.types.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('id', backend.database.types.GUID(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=False),
    sa.Column('slug', sa.String(length=32), nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_category'))
    )
    op.create_table('article',
    sa.Column('created_at', backend.database.types.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated_at', backend.database.types.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('id', backend.database.types.GUID(), nullable=False),
    sa.Column('title', sa.String(length=100), nullable=False),
    sa.Column('slug', sa.String(length=100), nullable=False),
    sa.Column('publish_date', backend.database.types.DateTime(timezone=True), nullable=False),
    sa.Column('last_updated', backend.database.types.DateTime(timezone=True), nullable=True),
    sa.Column('file_path', sa.String(length=255), nullable=True),
    sa.Column('header_image', sa.String(length=255), nullable=True),
    sa.Column('preview', sa.Text(), nullable=False),
    sa.Column('html', sa.Text(), nullable=False),
    sa.Column('category_id', backend.database.types.GUID(), nullable=True),
    sa.ForeignKeyConstraint(['category_id'], ['category.id'], name=op.f('fk_article_category_id_category')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_article'))
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('article')
    op.drop_table('category')
    # ### end Alembic commands ###
