15db7b91a97a_add_rtcp_mux.py 949 B

123456789101112131415161718192021222324252627282930313233
  1. """empty message
  2. Revision ID: 15db7b91a97a
  3. Revises: 465e70e8c337
  4. Create Date: 2017-03-08 16:56:38.108162
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '15db7b91a97a'
  8. down_revision = '465e70e8c337'
  9. from alembic import op
  10. import sqlalchemy as sa
  11. from sqlalchemy.dialects.postgresql import ENUM
  12. YESNO_NAME = 'yesno_values'
  13. YESNO_VALUES = ['yes', 'no']
  14. def upgrade():
  15. ############################# Enums ##############################
  16. # yesno_values have already been created, so use postgres enum object
  17. # type to get around "already created" issue - works okay with mysql
  18. yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
  19. op.add_column('ps_endpoints', sa.Column('rtcp_mux', yesno_values))
  20. def downgrade():
  21. if op.get_context().bind.dialect.name == 'mssql':
  22. op.drop_constraint('ck_ps_endpoints_rtcp_mux_yesno_values','ps_endpoints')
  23. op.drop_column('ps_endpoints', 'rtcp_mux')