[Asterisk-code-review] app_queue: Add alembic migration to add ringinuse to queue_members. (asterisk[18])

Sean Bright asteriskteam at digium.com
Wed Mar 24 16:13:36 CDT 2021


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/15705 )


Change subject: app_queue: Add alembic migration to add ringinuse to queue_members.
......................................................................

app_queue: Add alembic migration to add ringinuse to queue_members.

ASTERISK-28356 #close

Change-Id: I53a1bfdd3113d620bea88349019173a2f3f0ae39
---
A contrib/ast-db-manage/config/versions/8915fcc5766f_add_ringinuse_to_queue_members.py
1 file changed, 32 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/05/15705/1

diff --git a/contrib/ast-db-manage/config/versions/8915fcc5766f_add_ringinuse_to_queue_members.py b/contrib/ast-db-manage/config/versions/8915fcc5766f_add_ringinuse_to_queue_members.py
new file mode 100644
index 0000000..0738166
--- /dev/null
+++ b/contrib/ast-db-manage/config/versions/8915fcc5766f_add_ringinuse_to_queue_members.py
@@ -0,0 +1,32 @@
+"""Add ringinuse to queue_members
+
+Revision ID: 8915fcc5766f
+Revises: 61797b9fced6
+Create Date: 2021-03-24 09:28:46.901447
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '8915fcc5766f'
+down_revision = '61797b9fced6'
+
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects.postgresql import ENUM
+
+YESNO_NAME = 'yesno_values'
+YESNO_VALUES = ['yes', 'no']
+
+def upgrade():
+    ############################# Enums ##############################
+
+    # yesno_values have 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)
+
+    op.add_column('queue_members', sa.Column('ringinuse', yesno_values))
+
+def downgrade():
+    if op.get_context().bind.dialect.name == 'mssql':
+        op.drop_constraint('ck_queue_members_ringinuse_yesno_values','ps_endpoints')
+    op.drop_column('queue_members', 'ringinuse')

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

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I53a1bfdd3113d620bea88349019173a2f3f0ae39
Gerrit-Change-Number: 15705
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210324/37afa007/attachment.html>


More information about the asterisk-code-review mailing list