19 """Create queue tables 21 Revision ID: 28887f25a46f 23 Create Date: 2014-03-03 12:26:25.261640 28 revision =
'28887f25a46f' 29 down_revision =
'21e526ad3040' 31 from alembic
import op
32 from alembic
import context
33 import sqlalchemy
as sa
34 from sqlalchemy.dialects.postgresql
import ENUM
37 YESNO_NAME =
'yesno_values' 38 YESNO_VALUES = [
'yes',
'no']
40 QUEUE_STRATEGY_NAME =
'queue_strategy_values' 41 QUEUE_STRATEGY_VALUES = [
'ringall',
'leastrecent',
'fewestcalls',
'random',
'rrmemory',
42 'linear',
'wrandom',
'rrordered', ]
44 QUEUE_AUTOPAUSE_NAME =
'queue_autopause_values' 45 QUEUE_AUTOPAUSE_VALUES = [
'yes',
'no',
'all']
53 yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=
False)
55 queue_strategy_values = sa.Enum(*QUEUE_STRATEGY_VALUES, name=QUEUE_STRATEGY_NAME)
56 queue_autopause_values = sa.Enum(*QUEUE_AUTOPAUSE_VALUES, name=QUEUE_AUTOPAUSE_NAME)
62 sa.Column(
'name', sa.String(128), primary_key=
True, nullable=
False),
63 sa.Column(
'musiconhold', sa.String(128)),
64 sa.Column(
'announce', sa.String(128)),
65 sa.Column(
'context', sa.String(128)),
66 sa.Column(
'timeout', sa.Integer),
67 sa.Column(
'ringinuse', yesno_values),
68 sa.Column(
'setinterfacevar', yesno_values),
69 sa.Column(
'setqueuevar', yesno_values),
70 sa.Column(
'setqueueentryvar', yesno_values),
71 sa.Column(
'monitor_format', sa.String(8)),
72 sa.Column(
'membermacro', sa.String(512)),
73 sa.Column(
'membergosub', sa.String(512)),
74 sa.Column(
'queue_youarenext', sa.String(128)),
75 sa.Column(
'queue_thereare', sa.String(128)),
76 sa.Column(
'queue_callswaiting', sa.String(128)),
77 sa.Column(
'queue_quantity1', sa.String(128)),
78 sa.Column(
'queue_quantity2', sa.String(128)),
79 sa.Column(
'queue_holdtime', sa.String(128)),
80 sa.Column(
'queue_minutes', sa.String(128)),
81 sa.Column(
'queue_minute', sa.String(128)),
82 sa.Column(
'queue_seconds', sa.String(128)),
83 sa.Column(
'queue_thankyou', sa.String(128)),
84 sa.Column(
'queue_callerannounce', sa.String(128)),
85 sa.Column(
'queue_reporthold', sa.String(128)),
86 sa.Column(
'announce_frequency', sa.Integer),
87 sa.Column(
'announce_to_first_user', yesno_values),
88 sa.Column(
'min_announce_frequency', sa.Integer),
89 sa.Column(
'announce_round_seconds', sa.Integer),
90 sa.Column(
'announce_holdtime', sa.String(128)),
91 sa.Column(
'announce_position', sa.String(128)),
92 sa.Column(
'announce_position_limit', sa.Integer),
93 sa.Column(
'periodic_announce', sa.String(50)),
94 sa.Column(
'periodic_announce_frequency', sa.Integer),
95 sa.Column(
'relative_periodic_announce', yesno_values),
96 sa.Column(
'random_periodic_announce', yesno_values),
97 sa.Column(
'retry', sa.Integer),
98 sa.Column(
'wrapuptime', sa.Integer),
99 sa.Column(
'penaltymemberslimit', sa.Integer),
100 sa.Column(
'autofill', yesno_values),
101 sa.Column(
'monitor_type', sa.String(128)),
102 sa.Column(
'autopause', queue_autopause_values),
103 sa.Column(
'autopausedelay', sa.Integer),
104 sa.Column(
'autopausebusy', yesno_values),
105 sa.Column(
'autopauseunavail', yesno_values),
106 sa.Column(
'maxlen', sa.Integer),
107 sa.Column(
'servicelevel', sa.Integer),
108 sa.Column(
'strategy', queue_strategy_values),
109 sa.Column(
'joinempty', sa.String(128)),
110 sa.Column(
'leavewhenempty', sa.String(128)),
111 sa.Column(
'reportholdtime', yesno_values),
112 sa.Column(
'memberdelay', sa.Integer),
113 sa.Column(
'weight', sa.Integer),
114 sa.Column(
'timeoutrestart', yesno_values),
115 sa.Column(
'defaultrule', sa.String(128)),
116 sa.Column(
'timeoutpriority', sa.String(128))
121 sa.Column(
'queue_name', sa.String(80), primary_key=
True, nullable=
False),
122 sa.Column(
'interface', sa.String(80), primary_key=
True, nullable=
False),
123 sa.Column(
'uniqueid', sa.String(80), nullable=
False),
124 sa.Column(
'membername', sa.String(80)),
125 sa.Column(
'state_interface', sa.String(80)),
126 sa.Column(
'penalty', sa.Integer),
127 sa.Column(
'paused', sa.Integer)
134 op.drop_table(
'queues')
135 op.drop_table(
'queue_members')
139 sa.Enum(name=QUEUE_STRATEGY_NAME).drop(op.get_bind(), checkfirst=
False)
140 sa.Enum(name=QUEUE_AUTOPAUSE_NAME).drop(op.get_bind(), checkfirst=
False)