47f5fab6f46a_private_pull_request.py 787 B

123456789101112131415161718192021222324252627282930313233343536
  1. """private pull-request
  2. Revision ID: 47f5fab6f46a
  3. Revises: a13967424130
  4. Create Date: 2017-11-06 11:37:57.460886
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = '47f5fab6f46a'
  10. down_revision = 'a13967424130'
  11. def upgrade():
  12. ''' Add a private column in the pull_requests table
  13. '''
  14. op.add_column(
  15. 'pull_requests',
  16. sa.Column('private', sa.Boolean, nullable=True, default=False)
  17. )
  18. op.execute('''UPDATE "pull_requests" '''
  19. '''SET private=False;''')
  20. op.alter_column(
  21. 'pull_requests',
  22. column_name='private',
  23. nullable=False, existing_nullable=True)
  24. def downgrade():
  25. ''' Remove the private column
  26. '''
  27. op.drop_column('pull_requests', 'private')