Asterisk - The Open Source Telephony Project GIT-master-f36a736
0be05c3a8225_add_early_media_options.py
Go to the documentation of this file.
1"""Add early media options
2
3Revision ID: 0be05c3a8225
4Revises: d3e4284f8707
5Create Date: 2018-06-18 17:26:16.737692
6
7"""
8
9# revision identifiers, used by Alembic.
10revision = '0be05c3a8225'
11down_revision = 'd3e4284f8707'
12
13from alembic import op
14import sqlalchemy as sa
15from sqlalchemy.dialects.postgresql import ENUM
16
17YESNO_NAME = 'yesno_values'
18YESNO_VALUES = ['yes', 'no']
19
20def upgrade():
21 yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
22
23 op.add_column('ps_systems', sa.Column('follow_early_media_fork', yesno_values))
24 op.add_column('ps_systems', sa.Column('accept_multiple_sdp_answers', yesno_values))
25 op.add_column('ps_endpoints', sa.Column('follow_early_media_fork', yesno_values))
26 op.add_column('ps_endpoints', sa.Column('accept_multiple_sdp_answers', yesno_values))
27
29 if op.get_context().bind.dialect.name == 'mssql':
30 op.drop_constraint('ck_ps_systems_follow_early_media_fork_yesno_values','ps_systems')
31 op.drop_constraint('ck_ps_systems_accept_multiple_sdp_answers_yesno_values','ps_systems')
32 op.drop_constraint('ck_ps_endpoints_follow_early_media_fork_yesno_values','ps_endpoints')
33 op.drop_constraint('ck_ps_endpoints_accept_multiple_sdp_answers_yesno_values','ps_endpoints')
34 op.drop_column('ps_systems', 'follow_early_media_fork')
35 op.drop_column('ps_systems', 'accept_multiple_sdp_answers')
36 op.drop_column('ps_endpoints', 'follow_early_media_fork')
37 op.drop_column('ps_endpoints', 'accept_multiple_sdp_answers')