[Asterisk-code-review] alembic: Fix use callerid contact option add script. (asterisk[16])

Richard Mudgett asteriskteam at digium.com
Tue Oct 30 10:58:02 CDT 2018


Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/10569


Change subject: alembic: Fix use_callerid_contact option add script.
......................................................................

alembic: Fix use_callerid_contact option add script.

ASTERISK-28087

Change-Id: I046d018015427d0916fab571b5a4f5367476f729
---
M contrib/ast-db-manage/config/versions/2bb1a85135ad_pjsip_add_use_callerid_contact.py
1 file changed, 10 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/69/10569/1

diff --git a/contrib/ast-db-manage/config/versions/2bb1a85135ad_pjsip_add_use_callerid_contact.py b/contrib/ast-db-manage/config/versions/2bb1a85135ad_pjsip_add_use_callerid_contact.py
index 88c94f5..c4a9eab 100644
--- a/contrib/ast-db-manage/config/versions/2bb1a85135ad_pjsip_add_use_callerid_contact.py
+++ b/contrib/ast-db-manage/config/versions/2bb1a85135ad_pjsip_add_use_callerid_contact.py
@@ -14,21 +14,26 @@
 import sqlalchemy as sa
 from sqlalchemy.dialects.postgresql import ENUM
 
-YESNO_NAME = 'yesno_values'
-YESNO_VALUES = ['yes', 'no']
+AST_BOOL_NAME = 'ast_bool_values'
+# We'll just ignore the n/y and f/t abbreviations as Asterisk does not write
+# those aliases.
+AST_BOOL_VALUES = [ '0', '1',
+                    'off', 'on',
+                    'false', 'true',
+                    'no', 'yes' ]
 
 
 def upgrade():
     ############################# Enums ##############################
 
-    # yesno_values have already been created, so use postgres enum object
+    # ast_bool_values has already been created, so use postgres enum object
     # type to get around "already created" issue - works okay with mysql
-    yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
+    ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
 
     op.add_column('ps_globals', sa.Column('use_callerid_contact', yesno_values))
 
 
 def downgrade():
     if op.get_context().bind.dialect.name == 'mssql':
-        op.drop_constraint('ck_ps_globals_use_callerid_contact_yesno_values','ps_globals')
+        op.drop_constraint('ck_ps_globals_use_callerid_contact_ast_bool_values', 'ps_globals')
     op.drop_column('ps_globals', 'use_callerid_contact')

-- 
To view, visit https://gerrit.asterisk.org/10569
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: newchange
Gerrit-Change-Id: I046d018015427d0916fab571b5a4f5367476f729
Gerrit-Change-Number: 10569
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181030/8a186c0b/attachment-0001.html>


More information about the asterisk-code-review mailing list