<filename>discovery-provider/alembic/versions/3065a825c5f8_create_follow_model.py
"""create follow model

Revision ID: 3065a825c5f8
Revises: <PASSWORD>
Create Date: 2019-02-25 14:55:48.641899

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

# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('follows',
    sa.Column('blockhash', sa.String(), nullable=False),
    sa.Column('blocknumber', sa.Integer(), nullable=False),
    sa.Column('follower_user_id', sa.Integer(), nullable=False),
    sa.Column('followee_user_id', sa.Integer(), nullable=False),
    sa.Column('is_current', sa.Boolean(), nullable=False),
    sa.Column('is_delete', sa.Boolean(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['blockhash'], ['blocks.blockhash'], ),
    sa.ForeignKeyConstraint(['blocknumber'], ['blocks.number'], ),
    sa.PrimaryKeyConstraint('blockhash', 'follower_user_id', 'followee_user_id', 'is_current')
    )
    op.alter_column('reposts', 'timestamp',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('reposts', 'timestamp',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True)
    op.drop_table('follows')
    # ### end Alembic commands ###

<filename>discovery-provider/alembic/versions/3065a825c5f8_create_follow_model.py
"""create follow model

Revision ID: 3065a825c5f8
Revises: <PASSWORD>
Create Date: 2019-02-25 14:55:48.641899

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

# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('follows',
    sa.Column('blockhash', sa.String(), nullable=False),
    sa.Column('blocknumber', sa.Integer(), nullable=False),
    sa.Column('follower_user_id', sa.Integer(), nullable=False),
    sa.Column('followee_user_id', sa.Integer(), nullable=False),
    sa.Column('is_current', sa.Boolean(), nullable=False),
    sa.Column('is_delete', sa.Boolean(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['blockhash'], ['blocks.blockhash'], ),
    sa.ForeignKeyConstraint(['blocknumber'], ['blocks.number'], ),
    sa.PrimaryKeyConstraint('blockhash', 'follower_user_id', 'followee_user_id', 'is_current')
    )
    op.alter_column('reposts', 'timestamp',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('reposts', 'timestamp',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True)
    op.drop_table('follows')
    # ### end Alembic commands ###

create follow model  Revision ID: 3065a825c5f8 Revises: <PASSWORD> Create Date: 2019-02-25 14:55:48.641899 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###