"""add posts table

Revision ID: bff64a27bc9b
Revises: 4783cd3d66c8
Create Date: 2020-09-27 14:35:46.031402

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

# revision identifiers, used by Alembic.
revision = 'bff64a27bc9b'
down_revision = '4783cd3d66c8'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('location', sa.String(length=64), nullable=True),
    sa.Column('about_me', sa.Text(), nullable=True),
    sa.Column('member_since', sa.DateTime(), nullable=True),
    sa.Column('last_seen', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    op.create_table('posts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=255), nullable=True),
    sa.Column('summary', sa.Text(), nullable=True),
    sa.Column('body', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('views', sa.Integer(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_posts_timestamp'), 'posts', ['timestamp'], unique=False)
    op.drop_index('ix_user_email', table_name='user')
    op.drop_index('ix_user_username', table_name='user')
    op.drop_table('user')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
    sa.Column('username', mysql.VARCHAR(length=64), nullable=True),
    sa.Column('email', mysql.VARCHAR(length=120), nullable=True),
    sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True),
    sa.Column('about_me', mysql.TEXT(), nullable=True),
    sa.Column('last_seen', mysql.DATETIME(), nullable=True),
    sa.Column('location', mysql.VARCHAR(length=64), nullable=True),
    sa.Column('member_since', mysql.DATETIME(), nullable=True),
    sa.Column('name', mysql.VARCHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_user_username', 'user', ['username'], unique=True)
    op.create_index('ix_user_email', 'user', ['email'], unique=True)
    op.drop_index(op.f('ix_posts_timestamp'), table_name='posts')
    op.drop_table('posts')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')
    # ### end Alembic commands ###

a2739f6be3e9c7022ed04b637439e3cd68a61a47
<mask token>


def downgrade():
    op.create_table('user', sa.Column('id', mysql.INTEGER(display_width=11),
        autoincrement=True, nullable=False), sa.Column('username', mysql.
        VARCHAR(length=64), nullable=True), sa.Column('email', mysql.
        VARCHAR(length=120), nullable=True), sa.Column('password_hash',
        mysql.VARCHAR(length=128), nullable=True), sa.Column('about_me',
        mysql.TEXT(), nullable=True), sa.Column('last_seen', mysql.DATETIME
        (), nullable=True), sa.Column('location', mysql.VARCHAR(length=64),
        nullable=True), sa.Column('member_since', mysql.DATETIME(),
        nullable=True), sa.Column('name', mysql.VARCHAR(length=64),
        nullable=True), sa.PrimaryKeyConstraint('id'),
        mysql_default_charset='utf8', mysql_engine='InnoDB')
    op.create_index('ix_user_username', 'user', ['username'], unique=True)
    op.create_index('ix_user_email', 'user', ['email'], unique=True)
    op.drop_index(op.f('ix_posts_timestamp'), table_name='posts')
    op.drop_table('posts')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')

<mask token>


def upgrade():
    op.create_table('users', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('username', sa.String(length=64), nullable=True), sa.
        Column('email', sa.String(length=120), nullable=True), sa.Column(
        'password_hash', sa.String(length=128), nullable=True), sa.Column(
        'name', sa.String(length=64), nullable=True), sa.Column('location',
        sa.String(length=64), nullable=True), sa.Column('about_me', sa.Text
        (), nullable=True), sa.Column('member_since', sa.DateTime(),
        nullable=True), sa.Column('last_seen', sa.DateTime(), nullable=True
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'],
        unique=True)
    op.create_table('posts', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('title', sa.String(length=255), nullable=True), sa.Column
        ('summary', sa.Text(), nullable=True), sa.Column('body', sa.Text(),
        nullable=True), sa.Column('timestamp', sa.DateTime(), nullable=True
        ), sa.Column('views', sa.Integer(), nullable=True), sa.Column(
        'author_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(
        ['author_id'], ['users.id']), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_posts_timestamp'), 'posts', ['timestamp'],
        unique=False)
    op.drop_index('ix_user_email', table_name='user')
    op.drop_index('ix_user_username', table_name='user')
    op.drop_table('user')


def downgrade():
    op.create_table('user', sa.Column('id', mysql.INTEGER(display_width=11),
        autoincrement=True, nullable=False), sa.Column('username', mysql.
        VARCHAR(length=64), nullable=True), sa.Column('email', mysql.
        VARCHAR(length=120), nullable=True), sa.Column('password_hash',
        mysql.VARCHAR(length=128), nullable=True), sa.Column('about_me',
        mysql.TEXT(), nullable=True), sa.Column('last_seen', mysql.DATETIME
        (), nullable=True), sa.Column('location', mysql.VARCHAR(length=64),
        nullable=True), sa.Column('member_since', mysql.DATETIME(),
        nullable=True), sa.Column('name', mysql.VARCHAR(length=64),
        nullable=True), sa.PrimaryKeyConstraint('id'),
        mysql_default_charset='utf8', mysql_engine='InnoDB')
    op.create_index('ix_user_username', 'user', ['username'], unique=True)
    op.create_index('ix_user_email', 'user', ['email'], unique=True)
    op.drop_index(op.f('ix_posts_timestamp'), table_name='posts')
    op.drop_table('posts')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')

<mask token>
revision = 'bff64a27bc9b'
down_revision = '4783cd3d66c8'
branch_labels = None
depends_on = None


def upgrade():
    op.create_table('users', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('username', sa.String(length=64), nullable=True), sa.
        Column('email', sa.String(length=120), nullable=True), sa.Column(
        'password_hash', sa.String(length=128), nullable=True), sa.Column(
        'name', sa.String(length=64), nullable=True), sa.Column('location',
        sa.String(length=64), nullable=True), sa.Column('about_me', sa.Text
        (), nullable=True), sa.Column('member_since', sa.DateTime(),
        nullable=True), sa.Column('last_seen', sa.DateTime(), nullable=True
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'],
        unique=True)
    op.create_table('posts', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('title', sa.String(length=255), nullable=True), sa.Column
        ('summary', sa.Text(), nullable=True), sa.Column('body', sa.Text(),
        nullable=True), sa.Column('timestamp', sa.DateTime(), nullable=True
        ), sa.Column('views', sa.Integer(), nullable=True), sa.Column(
        'author_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(
        ['author_id'], ['users.id']), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_posts_timestamp'), 'posts', ['timestamp'],
        unique=False)
    op.drop_index('ix_user_email', table_name='user')
    op.drop_index('ix_user_username', table_name='user')
    op.drop_table('user')


def downgrade():
    op.create_table('user', sa.Column('id', mysql.INTEGER(display_width=11),
        autoincrement=True, nullable=False), sa.Column('username', mysql.
        VARCHAR(length=64), nullable=True), sa.Column('email', mysql.
        VARCHAR(length=120), nullable=True), sa.Column('password_hash',
        mysql.VARCHAR(length=128), nullable=True), sa.Column('about_me',
        mysql.TEXT(), nullable=True), sa.Column('last_seen', mysql.DATETIME
        (), nullable=True), sa.Column('location', mysql.VARCHAR(length=64),
        nullable=True), sa.Column('member_since', mysql.DATETIME(),
        nullable=True), sa.Column('name', mysql.VARCHAR(length=64),
        nullable=True), sa.PrimaryKeyConstraint('id'),
        mysql_default_charset='utf8', mysql_engine='InnoDB')
    op.create_index('ix_user_username', 'user', ['username'], unique=True)
    op.create_index('ix_user_email', 'user', ['email'], unique=True)
    op.drop_index(op.f('ix_posts_timestamp'), table_name='posts')
    op.drop_table('posts')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')

<mask token>
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
revision = 'bff64a27bc9b'
down_revision = '4783cd3d66c8'
branch_labels = None
depends_on = None


def upgrade():
    op.create_table('users', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('username', sa.String(length=64), nullable=True), sa.
        Column('email', sa.String(length=120), nullable=True), sa.Column(
        'password_hash', sa.String(length=128), nullable=True), sa.Column(
        'name', sa.String(length=64), nullable=True), sa.Column('location',
        sa.String(length=64), nullable=True), sa.Column('about_me', sa.Text
        (), nullable=True), sa.Column('member_since', sa.DateTime(),
        nullable=True), sa.Column('last_seen', sa.DateTime(), nullable=True
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'],
        unique=True)
    op.create_table('posts', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('title', sa.String(length=255), nullable=True), sa.Column
        ('summary', sa.Text(), nullable=True), sa.Column('body', sa.Text(),
        nullable=True), sa.Column('timestamp', sa.DateTime(), nullable=True
        ), sa.Column('views', sa.Integer(), nullable=True), sa.Column(
        'author_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(
        ['author_id'], ['users.id']), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_posts_timestamp'), 'posts', ['timestamp'],
        unique=False)
    op.drop_index('ix_user_email', table_name='user')
    op.drop_index('ix_user_username', table_name='user')
    op.drop_table('user')


def downgrade():
    op.create_table('user', sa.Column('id', mysql.INTEGER(display_width=11),
        autoincrement=True, nullable=False), sa.Column('username', mysql.
        VARCHAR(length=64), nullable=True), sa.Column('email', mysql.
        VARCHAR(length=120), nullable=True), sa.Column('password_hash',
        mysql.VARCHAR(length=128), nullable=True), sa.Column('about_me',
        mysql.TEXT(), nullable=True), sa.Column('last_seen', mysql.DATETIME
        (), nullable=True), sa.Column('location', mysql.VARCHAR(length=64),
        nullable=True), sa.Column('member_since', mysql.DATETIME(),
        nullable=True), sa.Column('name', mysql.VARCHAR(length=64),
        nullable=True), sa.PrimaryKeyConstraint('id'),
        mysql_default_charset='utf8', mysql_engine='InnoDB')
    op.create_index('ix_user_username', 'user', ['username'], unique=True)
    op.create_index('ix_user_email', 'user', ['email'], unique=True)
    op.drop_index(op.f('ix_posts_timestamp'), table_name='posts')
    op.drop_table('posts')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')

"""add posts table

Revision ID: bff64a27bc9b
Revises: 4783cd3d66c8
Create Date: 2020-09-27 14:35:46.031402

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

# revision identifiers, used by Alembic.
revision = 'bff64a27bc9b'
down_revision = '4783cd3d66c8'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('location', sa.String(length=64), nullable=True),
    sa.Column('about_me', sa.Text(), nullable=True),
    sa.Column('member_since', sa.DateTime(), nullable=True),
    sa.Column('last_seen', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    op.create_table('posts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=255), nullable=True),
    sa.Column('summary', sa.Text(), nullable=True),
    sa.Column('body', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('views', sa.Integer(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_posts_timestamp'), 'posts', ['timestamp'], unique=False)
    op.drop_index('ix_user_email', table_name='user')
    op.drop_index('ix_user_username', table_name='user')
    op.drop_table('user')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
    sa.Column('username', mysql.VARCHAR(length=64), nullable=True),
    sa.Column('email', mysql.VARCHAR(length=120), nullable=True),
    sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True),
    sa.Column('about_me', mysql.TEXT(), nullable=True),
    sa.Column('last_seen', mysql.DATETIME(), nullable=True),
    sa.Column('location', mysql.VARCHAR(length=64), nullable=True),
    sa.Column('member_since', mysql.DATETIME(), nullable=True),
    sa.Column('name', mysql.VARCHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_user_username', 'user', ['username'], unique=True)
    op.create_index('ix_user_email', 'user', ['email'], unique=True)
    op.drop_index(op.f('ix_posts_timestamp'), table_name='posts')
    op.drop_table('posts')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')
    # ### end Alembic commands ###
