[Asterisk-code-review] alembic: fix suppress q850 reason headers column name (asterisk[master])

Joshua Colp asteriskteam at digium.com
Wed Sep 19 09:36:38 CDT 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10180 )

Change subject: alembic: fix suppress_q850_reason_headers column name
......................................................................

alembic: fix suppress_q850_reason_headers column name

In the original commit introducing the feature the column in the alembic
script was called 'suppress_q850_reason_header'.
In the code however the option is called 'suppress_q850_reason_headers'
(trailing 's'). This leads to errors when ARI push configuration is used.

Change-Id: Ie84808adbca6fcc9136556e4f5d741adbef5d14f
---
A contrib/ast-db-manage/config/versions/7f85dd44c775_fix_suppress_q850_reason_headers.py
1 file changed, 43 insertions(+), 0 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Joshua Colp: Approved for Submit



diff --git a/contrib/ast-db-manage/config/versions/7f85dd44c775_fix_suppress_q850_reason_headers.py b/contrib/ast-db-manage/config/versions/7f85dd44c775_fix_suppress_q850_reason_headers.py
new file mode 100644
index 0000000..911349f
--- /dev/null
+++ b/contrib/ast-db-manage/config/versions/7f85dd44c775_fix_suppress_q850_reason_headers.py
@@ -0,0 +1,43 @@
+"""fix suppress_q850_reason_headers
+
+Revision ID: 7f85dd44c775
+Revises: fe6592859b85
+Create Date: 2018-09-18 16:16:29.304815
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '7f85dd44c775'
+down_revision = 'fe6592859b85'
+
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects.postgresql import ENUM
+
+YESNO_NAME = 'yesno_values'
+YESNO_VALUES = ['yes', 'no']
+
+
+def upgrade():
+    yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
+
+    if op.get_context().bind.dialect.name != 'mssql':
+        op.alter_column('ps_endpoints', 'suppress_q850_reason_header', type_=yesno_values,
+                        new_column_name='suppress_q850_reason_headers')
+    else:
+        op.alter_column('ps_endpoints', 'suppress_q850_reason_header', existing_type=yesno_values, type_=sa.String(3),
+                        new_column_name='suppress_q850_reason_headers')
+        yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=True)
+        op.alter_column('ps_endpoints', 'suppress_q850_reason_headers', existing_type=sa.String(3), type_=yesno_values)
+
+
+def downgrade():
+    yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
+    if op.get_context().bind.dialect.name != 'mssql':
+        op.alter_column('ps_endpoints', 'suppress_q850_reason_headers', type_=yesno_values,
+                        new_column_name='suppress_q850_reason_header')
+    else:
+        op.alter_column('ps_endpoints', 'suppress_q850_reason_headers', existing_type=yesno_values, type_=sa.String(3),
+                        new_column_name='suppress_q850_reason_header')
+        yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=True)
+        op.alter_column('ps_endpoints', 'suppress_q850_reason_header', existing_type=sa.String(3), type_=yesno_values)
\ No newline at end of file

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie84808adbca6fcc9136556e4f5d741adbef5d14f
Gerrit-Change-Number: 10180
Gerrit-PatchSet: 1
Gerrit-Owner: Florian Floimair <f.floimair at commend.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180919/e0ce281d/attachment-0001.html>


More information about the asterisk-code-review mailing list