Batch migrations from model updates (#42)

This commit is contained in:
Daniel Ternyak 2019-10-24 12:50:57 -05:00 committed by GitHub
parent 5f049d899b
commit dd9bcb8865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 130 additions and 0 deletions

View File

@ -0,0 +1,43 @@
"""empty message
Revision ID: 515abdefed7a
Revises: 4505f00c4ebd
Create Date: 2019-10-17 16:41:58.519224
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '515abdefed7a'
down_revision = '4505f00c4ebd'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('proposal_subscribers',
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('proposal_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['proposal_id'], ['proposal.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
)
op.add_column('proposal', sa.Column('accepted_with_funding', sa.Boolean(), nullable=True))
op.add_column('proposal', sa.Column('version', sa.String(length=255), nullable=True))
op.alter_column('proposal', 'deadline_duration',
existing_type=sa.INTEGER(),
nullable=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('proposal', 'deadline_duration',
existing_type=sa.INTEGER(),
nullable=False)
op.drop_column('proposal', 'version')
op.drop_column('proposal', 'accepted_with_funding')
op.drop_table('proposal_subscribers')
# ### end Alembic commands ###

View File

@ -0,0 +1,47 @@
"""empty message
Revision ID: 7fea7427e9d6
Revises: f24d53f211ef
Create Date: 2019-10-24 12:18:39.734758
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7fea7427e9d6'
down_revision = 'f24d53f211ef'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('rfp_liker',
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('rfp_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['rfp_id'], ['rfp.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
)
op.create_table('proposal_liker',
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('proposal_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['proposal_id'], ['proposal.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
)
op.create_table('comment_liker',
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('comment_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['comment_id'], ['comment.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('comment_liker')
op.drop_table('proposal_liker')
op.drop_table('rfp_liker')
# ### end Alembic commands ###

View File

@ -0,0 +1,40 @@
"""empty message
Revision ID: f24d53f211ef
Revises: 515abdefed7a
Create Date: 2019-10-23 16:32:02.161367
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f24d53f211ef'
down_revision = '515abdefed7a'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('proposal_follower',
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('proposal_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['proposal_id'], ['proposal.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
)
op.drop_table('proposal_subscribers')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('proposal_subscribers',
sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('proposal_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['proposal_id'], ['proposal.id'], name='proposal_subscribers_proposal_id_fkey'),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], name='proposal_subscribers_user_id_fkey')
)
op.drop_table('proposal_follower')
# ### end Alembic commands ###