summaryrefslogtreecommitdiff
path: root/contrib/ast-db-manage/config/versions/a541e0b5e89_add_pjsip_max_initial_qualify_time.py
AgeCommit message (Collapse)Author
2016-04-07alembic: Remove batch operations (and sqlite support)George Joseph
Because SQLite doesn't support full ALTER capabilities, alembic scripts require batch operations. However, that capability wasn't available until 0.7.0 which some distributions haven't reached yet. Therefore, the batch operations introduced in commit 86d6e44cc (review 2319) have been reverted and SQLite is unsupported again, for now anyway. Tested the full upgrade and downgrade on MySQL/Mariadb and Postgresql. ASTERISK-25890 #close Reported-by: Harley Peters Change-Id: I82eba5456736320256f6775f5b0b40133f4d1c80
2016-03-02alembic: Fix downgrade and tweak for sqliteGeorge Joseph
Downgrade had a few issues. First there was an errant 'update' statement in add_auto_dtmf_mode that looks like it was a copy/paste error. Second, we weren't cleaning up the ENUMs so subsequent upgrades on postgres failed because the types already existed. For sqlite... sqlite doesn't support ALTER or DROP COLUMN directly. Fortunately alembic batch_operations takes care of this for us if we use it so the alter and drops were converted to use batch operations. Here's an example downgrade: with op.batch_alter_table('ps_endpoints') as batch_op: batch_op.drop_column('tos_audio') batch_op.drop_column('tos_video') batch_op.add_column(sa.Column('tos_audio', yesno_values)) batch_op.add_column(sa.Column('tos_video', yesno_values)) batch_op.drop_column('cos_audio') batch_op.drop_column('cos_video') batch_op.add_column(sa.Column('cos_audio', yesno_values)) batch_op.add_column(sa.Column('cos_video', yesno_values)) with op.batch_alter_table('ps_transports') as batch_op: batch_op.drop_column('tos') batch_op.add_column(sa.Column('tos', yesno_values)) # Can't cast integers to YESNO_VALUES, so dropping and adding is required batch_op.drop_column('cos') batch_op.add_column(sa.Column('cos', yesno_values)) Upgrades from base to head and downgrades from head to base were tested repeatedly for postgresql, mysql/mariadb, and sqlite3. Change-Id: I862b0739eb3fd45ec3412dcc13c2340e1b7baef8
2015-04-16res_pjsip: Add global option to limit the maximum time for initial qualifiesGeorge Joseph
Currently when Asterisk starts initial qualifies of contacts are spread out randomly between 0 and qualify_timeout to prevent network and system overload. If a contact's qualify_frequency is 5 minutes however, that contact may be unavailable to accept calls for the entire 5 minutes after startup. So while staggering the initial qualifies is a good idea, basing the time on qualify_timeout could leave contacts unavailable for too long. This patch adds a new global parameter "max_initial_qualify_time" that sets the maximum time for the initial qualifies. This way you could make sure that all your contacts are initialy, randomly qualified within say 30 seconds but still have the contact's ongoing qualifies at a 5 minute interval. If max_initial_qualify_time is > 0, the formula is initial_interval = min(max_initial_interval, qualify_timeout * random(). If not set, qualify_timeout is used. The default is "0" (disabled). ASTERISK-24863 #close Change-Id: Ib80498aa1ea9923277bef51d6a9015c9c79740f4 Tested-by: George Joseph <george.joseph@fairview5.com>