Asterisk - The Open Source Telephony Project GIT-master-3dee037
44bd6dd914fa_add_qualify_2xx_only_option.py
Go to the documentation of this file.
1"""add qualify 2xx only option
2
3Revision ID: 44bd6dd914fa
4Revises: 4f91fc18c979
5Create Date: 2024-12-02 21:08:41.130023
6
7"""
8
9# revision identifiers, used by Alembic.
10revision = '44bd6dd914fa'
11down_revision = '4f91fc18c979'
12
13from alembic import op
14import sqlalchemy as sa
15from sqlalchemy.dialects.postgresql import ENUM
16
17AST_BOOL_NAME = 'ast_bool_values'
18AST_BOOL_VALUES = [ '0', '1',
19 'off', 'on',
20 'false', 'true',
21 'no', 'yes' ]
22
23def upgrade():
24 ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
25 op.add_column('ps_aors', sa.Column('qualify_2xx_only', ast_bool_values))
26 op.add_column('ps_contacts', sa.Column('qualify_2xx_only', ast_bool_values))
27
28
30 if op.get_context().bind.dialect.name == 'mssql':
31 op.drop_constraint('ck_ps_aors_qualify_2xx_only_ast_bool_values', 'ps_aors')
32 op.drop_constraint('ck_ps_contacts_qualify_2xx_only_ast_bool_values', 'ps_contacts')
33 op.drop_column('ps_aors', 'qualify_2xx_only')
34 op.drop_column('ps_contacts', 'qualify_2xx_only')