4255158a6913_create_private_column_in_project_table.py 779 B

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