1 """taskprocessor_overload_trigger 3 Revision ID: f3c0b8695b66 5 Create Date: 2019-02-15 15:03:50.106790 10 revision =
'f3c0b8695b66' 11 down_revision =
'0838f8db6a61' 13 from alembic
import op
14 import sqlalchemy
as sa
15 from sqlalchemy.dialects.postgresql
import ENUM
17 PJSIP_TASKPROCESSOR_OVERLOAD_TRIGGER_NAME =
'pjsip_taskprocessor_overload_trigger_values' 18 PJSIP_TASKPROCESSOR_OVERLOAD_TRIGGER_VALUES = [
'none',
'global',
'pjsip_only']
21 context = op.get_context()
23 if context.bind.dialect.name ==
'postgresql':
24 enum = ENUM(*PJSIP_TASKPROCESSOR_OVERLOAD_TRIGGER_VALUES,
25 name=PJSIP_TASKPROCESSOR_OVERLOAD_TRIGGER_NAME)
26 enum.create(op.get_bind(), checkfirst=
False)
28 op.add_column(
'ps_globals',
29 sa.Column(
'taskprocessor_overload_trigger',
30 sa.Enum(*PJSIP_TASKPROCESSOR_OVERLOAD_TRIGGER_VALUES,
31 name=PJSIP_TASKPROCESSOR_OVERLOAD_TRIGGER_NAME)))
34 context = op.get_context()
36 if context.bind.dialect.name ==
'mssql':
37 op.drop_constraint(
'ck_ps_globals_taskprocessor_overload_trigger_pjsip_taskprocessor_overload_trigger_values',
'ps_globals')
38 op.drop_column(
'ps_globals',
'taskprocessor_overload_trigger')
40 if context.bind.dialect.name ==
'postgresql':
41 enum = ENUM(*PJSIP_TASKPROCESSOR_OVERLOAD_TRIGGER_VALUES,
42 name=PJSIP_TASKPROCESSOR_OVERLOAD_TRIGGER_NAME)
43 enum.drop(op.get_bind(), checkfirst=
False)