summaryrefslogtreecommitdiff
path: root/contrib/ast-db-manage
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ast-db-manage')
-rw-r--r--contrib/ast-db-manage/config/versions/164abbd708c_add_auto_info_to_endpoint_dtmf_mode.py58
-rw-r--r--contrib/ast-db-manage/config/versions/b83645976fdd_add_dtls_fingerprint_to_ps_endpoints.py38
-rw-r--r--contrib/ast-db-manage/config/versions/d7983954dd96_add_ps_endpoints_notify_early_inuse_.py30
-rw-r--r--contrib/ast-db-manage/config/versions/f3d1c5d38b56_add_prune_on_boot.py31
4 files changed, 157 insertions, 0 deletions
diff --git a/contrib/ast-db-manage/config/versions/164abbd708c_add_auto_info_to_endpoint_dtmf_mode.py b/contrib/ast-db-manage/config/versions/164abbd708c_add_auto_info_to_endpoint_dtmf_mode.py
new file mode 100644
index 000000000..932773f6d
--- /dev/null
+++ b/contrib/ast-db-manage/config/versions/164abbd708c_add_auto_info_to_endpoint_dtmf_mode.py
@@ -0,0 +1,58 @@
+"""Add auto_info to endpoint dtmf_mode
+
+Revision ID: 164abbd708c
+Revises: 86bb1efa278d
+Create Date: 2017-06-19 13:55:15.354706
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '164abbd708c'
+down_revision = 'd7983954dd96'
+
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects.postgresql import ENUM
+
+OLD_ENUM = ['rfc4733', 'inband', 'info', 'auto']
+NEW_ENUM = ['rfc4733', 'inband', 'info', 'auto', 'auto_info']
+
+old_type = sa.Enum(*OLD_ENUM, name='pjsip_dtmf_mode_values_v2')
+new_type = sa.Enum(*NEW_ENUM, name='pjsip_dtmf_mode_values_v3')
+
+def upgrade():
+ context = op.get_context()
+
+ # Upgrading to this revision WILL clear your directmedia values.
+ if context.bind.dialect.name != 'postgresql':
+ op.alter_column('ps_endpoints', 'dtmf_mode',
+ type_=new_type,
+ existing_type=old_type)
+ else:
+ enum = ENUM('rfc4733', 'inband', 'info', 'auto', 'auto_info',
+ name='pjsip_dtmf_mode_values_v3')
+ enum.create(op.get_bind(), checkfirst=False)
+
+ op.execute('ALTER TABLE ps_endpoints ALTER COLUMN dtmf_mode TYPE'
+ ' pjsip_dtmf_mode_values_v3 USING'
+ ' dtmf_mode::text::pjsip_dtmf_mode_values_v3')
+
+ ENUM(name="pjsip_dtmf_mode_values_v2").drop(op.get_bind(), checkfirst=False)
+
+def downgrade():
+ context = op.get_context()
+
+ if context.bind.dialect.name != 'postgresql':
+ op.alter_column('ps_endpoints', 'dtmf_mode',
+ type_=old_type,
+ existing_type=new_type)
+ else:
+ enum = ENUM('rfc4733', 'inband', 'info', 'auto',
+ name='pjsip_dtmf_mode_values_v2')
+ enum.create(op.get_bind(), checkfirst=False)
+
+ op.execute('ALTER TABLE ps_endpoints ALTER COLUMN dtmf_mode TYPE'
+ ' pjsip_dtmf_mode_values USING'
+ ' dtmf_mode::text::pjsip_dtmf_mode_values_v2')
+
+ ENUM(name="pjsip_dtmf_mode_values_v3").drop(op.get_bind(), checkfirst=False)
diff --git a/contrib/ast-db-manage/config/versions/b83645976fdd_add_dtls_fingerprint_to_ps_endpoints.py b/contrib/ast-db-manage/config/versions/b83645976fdd_add_dtls_fingerprint_to_ps_endpoints.py
new file mode 100644
index 000000000..3d4f74de5
--- /dev/null
+++ b/contrib/ast-db-manage/config/versions/b83645976fdd_add_dtls_fingerprint_to_ps_endpoints.py
@@ -0,0 +1,38 @@
+"""add dtls_fingerprint to ps_endpoints
+
+Revision ID: b83645976fdd
+Revises: f3d1c5d38b56
+Create Date: 2017-08-03 09:01:49.558111
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'b83645976fdd'
+down_revision = 'f3d1c5d38b56'
+
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects.postgresql import ENUM
+
+SHA_HASH_NAME = 'sha_hash_values'
+SHA_HASH_VALUES = ['SHA-1', 'SHA-256']
+
+def upgrade():
+ context = op.get_context()
+
+ if context.bind.dialect.name == 'postgresql':
+ enum = ENUM(*SHA_HASH_VALUES, name=SHA_HASH_NAME)
+ enum.create(op.get_bind(), checkfirst=False)
+
+ op.add_column('ps_endpoints',
+ sa.Column('dtls_fingerprint', ENUM(*SHA_HASH_VALUES,
+ name=SHA_HASH_NAME, create_type=False)))
+
+def downgrade():
+ context = op.get_context()
+
+ op.drop_column('ps_endpoints', 'dtls_fingerprint')
+
+ if context.bind.dialect.name == 'postgresql':
+ enum = ENUM(*SHA_HASH_VALUES, name=SHA_HASH_NAME)
+ enum.drop(op.get_bind(), checkfirst=False)
diff --git a/contrib/ast-db-manage/config/versions/d7983954dd96_add_ps_endpoints_notify_early_inuse_.py b/contrib/ast-db-manage/config/versions/d7983954dd96_add_ps_endpoints_notify_early_inuse_.py
new file mode 100644
index 000000000..e1dcdd133
--- /dev/null
+++ b/contrib/ast-db-manage/config/versions/d7983954dd96_add_ps_endpoints_notify_early_inuse_.py
@@ -0,0 +1,30 @@
+"""add ps_endpoints.notify_early_inuse_ringing
+
+Revision ID: d7983954dd96
+Revises: 86bb1efa278d
+Create Date: 2017-06-05 15:44:41.152280
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'd7983954dd96'
+down_revision = '86bb1efa278d'
+
+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('ps_endpoints', sa.Column('notify_early_inuse_ringing', yesno_values))
+
+def downgrade():
+ op.drop_column('ps_endpoints', 'notify_early_inuse_ringing')
diff --git a/contrib/ast-db-manage/config/versions/f3d1c5d38b56_add_prune_on_boot.py b/contrib/ast-db-manage/config/versions/f3d1c5d38b56_add_prune_on_boot.py
new file mode 100644
index 000000000..759664616
--- /dev/null
+++ b/contrib/ast-db-manage/config/versions/f3d1c5d38b56_add_prune_on_boot.py
@@ -0,0 +1,31 @@
+"""add_prune_on_boot
+
+Revision ID: f3d1c5d38b56
+Revises: 164abbd708c
+Create Date: 2017-08-04 17:31:23.124767
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'f3d1c5d38b56'
+down_revision = '164abbd708c'
+
+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('ps_contacts', sa.Column('prune_on_boot', yesno_values))
+
+
+def downgrade():
+ op.drop_column('ps_contacts', 'prune_on_boot')