Asterisk - The Open Source Telephony Project GIT-master-f36a736
0bee61aa9425_allow_180_ringing_with_sdp.py
Go to the documentation of this file.
1"""allow_sending_180_after_183
2
3Revision ID: 0bee61aa9425
4Revises: 8f72185e437f
5Create Date: 2022-04-07 13:51:33.400664
6
7"""
8from alembic import op
9import sqlalchemy as sa
10from sqlalchemy.dialects.postgresql import ENUM
11
12# revision identifiers, used by Alembic.
13revision = '0bee61aa9425'
14down_revision = '8f72185e437f'
15AST_BOOL_NAME = 'ast_bool_values'
16# We'll just ignore the n/y and f/t abbreviations as Asterisk does not write
17# those aliases.
18AST_BOOL_VALUES = [ '0', '1',
19 'off', 'on',
20 'false', 'true',
21 'no', 'yes' ]
22
23def upgrade():
24 ############################# Enums ##############################
25
26 # ast_bool_values has already been created, so use postgres enum object
27 # type to get around "already created" issue - works okay with mysql
28 ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
29
30 op.add_column('ps_globals', sa.Column('allow_sending_180_after_183', ast_bool_values))
31
32
34 if op.get_context().bind.dialect.name == 'mssql':
35 op.drop_constraint('ck_ps_globals_allow_sending_180_after_183_ast_bool_values', 'ps_globals')
36 op.drop_column('ps_globals', 'allow_sending_180_after_183')