summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2014-01-31 22:23:42 +0000
committerKevin Harwell <kharwell@digium.com>2014-01-31 22:23:42 +0000
commite29c5e0c5c952427047860ec44038a85d479c202 (patch)
tree45cc61d75b5293a0bc3f4f327f851a4db219d64c
parent6b114b654eb498bce14f91ce9240ae48d5c33ff6 (diff)
alembic: script modifications due to errors
A couple of the scripts had errors that would not allow a full migration to take place. The extensions table needed to make its 'id' column a primary key in order to work with mysql. The other script ...add_endpoints... was missing tables that it was trying to add columns to. Added the primary key on id for extensions and added the tables in for the missing pjsip configuration options. While it is not ideal to modify already released scripts this was a case where it had to be done due to errors in the script and lacking a better alternative. Review: https://reviewboard.asterisk.org/r/3167/ ........ Merged revisions 407019 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--UPGRADE.txt21
-rwxr-xr-xcontrib/ast-db-manage/config/versions/2fc7930b41b3_add_pjsip_endpoint_options_for_12_1.py167
-rw-r--r--contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py4
3 files changed, 181 insertions, 11 deletions
diff --git a/UPGRADE.txt b/UPGRADE.txt
index bf4366a74..21bc6b4ea 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -50,5 +50,26 @@ Configuration Files:
- The manager.conf 'eventfilter' now takes an "extended" regular expression
instead of a "basic" one.
+Realtime Configuration:
+ * New columns have been added to realtime tables for 'support_path' on
+ ps_registrations and ps_aors and for 'path' on ps_contacts for the new
+ SIP Path support in chan_pjsip.
+ * The following new tables have been added for pjsip realtime: 'ps_systems',
+ 'ps_globals', 'ps_tranports', 'ps_registrations'.
+ * The following columns were added to the 'ps_aors' realtime table:
+ 'maximum_expiration', 'outbound_proxy', and 'support_path'.
+ * The following columns were added to the 'ps_contacts' realtime table:
+ 'outbound_proxy' and 'path'.
+ * New columns have been added to the ps_endpoints realtime table for the
+ 'media_address', 'redirect_method' and 'set_var' options. Also the
+ 'mwi_fromuser' column was renamed to 'mwi_from_user'.
+ * WARNING: The database migration script that adds the 'extensions' table for
+ realtime had to be modified due to an error when installing for MySQL. The
+ 'extensions' table's 'id' column was changed to be a primary key. This could
+ potentially cause a migration problem. If so, it may be necessary to
+ manually alter the affected table/column to bring it back in line with the
+ migration scripts.
+
+
===========================================================
===========================================================
diff --git a/contrib/ast-db-manage/config/versions/2fc7930b41b3_add_pjsip_endpoint_options_for_12_1.py b/contrib/ast-db-manage/config/versions/2fc7930b41b3_add_pjsip_endpoint_options_for_12_1.py
index 979aea8f9..3119563f7 100755
--- a/contrib/ast-db-manage/config/versions/2fc7930b41b3_add_pjsip_endpoint_options_for_12_1.py
+++ b/contrib/ast-db-manage/config/versions/2fc7930b41b3_add_pjsip_endpoint_options_for_12_1.py
@@ -1,4 +1,4 @@
-"""Add pjsip endpoint options for 12.1
+"""Add/Update tables for pjsip
Revision ID: 2fc7930b41b3
Revises: 581a4264e537
@@ -13,20 +13,169 @@ down_revision = '581a4264e537'
from alembic import op
import sqlalchemy as sa
+YESNO_NAME = 'yesno_values'
YESNO_VALUES = ['yes', 'no']
-REDIRECT_METHODS = ['user', 'uri_core', 'uri_pjsip']
+
+PJSIP_REDIRECT_METHOD_NAME = 'pjsip_redirect_method_values'
+PJSIP_REDIRECT_METHOD_VALUES = ['user', 'uri_core', 'uri_pjsip']
+
+PJSIP_TRANSPORT_METHOD_NAME = 'pjsip_transport_method_values'
+PJSIP_TRANSPORT_METHOD_VALUES = ['default', 'unspecified', 'tlsv1', 'sslv2',
+ 'sslv3', 'sslv23']
+
+PJSIP_TRANSPORT_PROTOCOL_NAME = 'pjsip_transport_protocol_values'
+PJSIP_TRANSPORT_PROTOCOL_VALUES = ['udp', 'tcp', 'tls', 'ws', 'wss']
+
+def create_enum(name, check_first, *args):
+ """Create an enumeration with the given name."""
+ res = sa.Enum(*args, name=name)
+ res.create(op.get_bind(), checkfirst=check_first)
+ return res
+
+def drop_enum(name):
+ """Drop the named enumeration from the database."""
+ sa.Enum(name=name).drop(op.get_bind(), checkfirst=False)
def upgrade():
- op.add_column('ps_endpoints', sa.Column('redirect_method', sa.Enum(*REDIRECT_METHODS, name='redirect_methods')))
+ ############################# Enums ##############################
+
+ yesno_values = sa.Enum(*YESNO_VALUES, name=YESNO_NAME)
+
+ # for some reason when using 'add_column' if you don't create the enum
+ # first it will think it already exists and fail
+ pjsip_redirect_method_values = sa.Enum(
+ *PJSIP_REDIRECT_METHOD_VALUES, name=PJSIP_REDIRECT_METHOD_NAME)
+ pjsip_redirect_method_values.create(op.get_bind(), checkfirst=True)
+
+ pjsip_transport_method_values = sa.Enum(
+ *PJSIP_TRANSPORT_METHOD_VALUES, name=PJSIP_TRANSPORT_METHOD_NAME)
+
+ pjsip_transport_protocol_values = sa.Enum(
+ *PJSIP_TRANSPORT_PROTOCOL_VALUES, name=PJSIP_TRANSPORT_PROTOCOL_NAME)
+
+ ######################### create tables ##########################
+
+ op.create_table(
+ 'ps_systems',
+ sa.Column('id', sa.String(40), nullable=False, unique=True),
+ sa.Column('timer_t1', sa.Integer),
+ sa.Column('timer_b', sa.Integer),
+ sa.Column('compact_headers', yesno_values),
+ sa.Column('threadpool_initial_size', sa.Integer),
+ sa.Column('threadpool_auto_increment', sa.Integer),
+ sa.Column('threadpool_idle_timeout', sa.Integer),
+ sa.Column('threadpool_max_size', sa.Integer),
+ )
+
+ op.create_index('ps_systems_id', 'ps_systems', ['id'])
+
+ op.create_table(
+ 'ps_globals',
+ sa.Column('id', sa.String(40), nullable=False, unique=True),
+ sa.Column('max_forwards', sa.Integer),
+ sa.Column('user_agent', sa.String(40)),
+ sa.Column('default_outbound_endpoint', sa.String(40)),
+ )
+
+ op.create_index('ps_globals_id', 'ps_globals', ['id'])
+
+ op.create_table(
+ 'ps_transports',
+ sa.Column('id', sa.String(40), nullable=False, unique=True),
+ sa.Column('async_operations', sa.Integer),
+ sa.Column('bind', sa.String(40)),
+ sa.Column('ca_list_file', sa.String(200)),
+ sa.Column('cert_file', sa.String(200)),
+ sa.Column('cipher', sa.String(200)),
+ sa.Column('domain', sa.String(40)),
+ sa.Column('external_media_address', sa.String(40)),
+ sa.Column('external_signaling_address', sa.String(40)),
+ sa.Column('external_signaling_port', sa.Integer),
+ sa.Column('method', pjsip_transport_method_values),
+ sa.Column('local_net', sa.String(40)),
+ sa.Column('password', sa.String(40)),
+ sa.Column('priv_key_file', sa.String(200)),
+ sa.Column('protocol', pjsip_transport_protocol_values),
+ sa.Column('require_client_cert', yesno_values),
+ sa.Column('verify_client', yesno_values),
+ sa.Column('verifiy_server', yesno_values),
+ sa.Column('tos', yesno_values),
+ sa.Column('cos', yesno_values),
+ )
+
+ op.create_index('ps_transports_id', 'ps_transports', ['id'])
+
+ op.create_table(
+ 'ps_registrations',
+ sa.Column('id', sa.String(40), nullable=False, unique=True),
+ sa.Column('auth_rejection_permanent', yesno_values),
+ sa.Column('client_uri', sa.String(40)),
+ sa.Column('contact_user', sa.String(40)),
+ sa.Column('expiration', sa.Integer),
+ sa.Column('max_retries', sa.Integer),
+ sa.Column('outbound_auth', sa.String(40)),
+ sa.Column('outbound_proxy', sa.String(40)),
+ sa.Column('retry_interval', sa.Integer),
+ sa.Column('forbidden_retry_interval', sa.Integer),
+ sa.Column('server_uri', sa.String(40)),
+ sa.Column('transport', sa.String(40)),
+ sa.Column('support_path', yesno_values),
+ )
+
+ op.create_index('ps_registrations_id', 'ps_registrations', ['id'])
+
+ ########################## add columns ###########################
+
+ # new columns for endpoints
+ op.add_column('ps_endpoints', sa.Column('media_address', sa.String(40)))
+ op.add_column('ps_endpoints', sa.Column('redirect_method',
+ pjsip_redirect_method_values))
op.add_column('ps_endpoints', sa.Column('set_var', sa.Text()))
+
+ # rename mwi_fromuser to mwi_from_user
+ op.alter_column('ps_endpoints', 'mwi_fromuser',
+ new_column_name='mwi_from_user',
+ existing_type=sa.String(40))
+
+ # new columns for contacts
+ op.add_column('ps_contacts', sa.Column('outbound_proxy', sa.String(40)))
op.add_column('ps_contacts', sa.Column('path', sa.Text()))
- op.add_column('ps_aors', sa.Column('support_path', sa.Enum(*YESNO_VALUES, name='yesno_values')))
- op.add_column('ps_registrations', sa.Column('support_path', sa.Enum(*YESNO_VALUES, name='yesno_values')))
+ # new columns for aors
+ op.add_column('ps_aors', sa.Column('maximum_expiration', sa.Integer))
+ op.add_column('ps_aors', sa.Column('outbound_proxy', sa.String(40)))
+ op.add_column('ps_aors', sa.Column('support_path', yesno_values))
def downgrade():
- op.drop_column('ps_endpoints', 'redirect_method')
- op.drop_column('ps_endpoints', 'set_var')
- op.drop_column('ps_contacts', 'path')
+ ########################## drop columns ##########################
+
op.drop_column('ps_aors', 'support_path')
- op.drop_column('ps_registrations', 'support_path')
+ op.drop_column('ps_aors', 'outbound_proxy')
+ op.drop_column('ps_aors', 'maximum_expiration')
+
+ op.drop_column('ps_contacts', 'path')
+ op.drop_column('ps_contacts', 'outbound_proxy')
+
+ op.alter_column('ps_endpoints', 'mwi_from_user',
+ new_column_name='mwi_fromuser',
+ existing_type=sa.String(40))
+
+ op.drop_column('ps_endpoints', 'set_var')
+ op.drop_column('ps_endpoints', 'redirect_method')
+ op.drop_column('ps_endpoints', 'media_address')
+
+ ########################## drop tables ###########################
+
+ op.drop_table('ps_registrations')
+ op.drop_table('ps_transports')
+ op.drop_table('ps_globals')
+ op.drop_table('ps_systems')
+
+ ########################## drop enums ############################
+
+ sa.Enum(name=PJSIP_TRANSPORT_PROTOCOL_NAME).drop(
+ op.get_bind(), checkfirst=False)
+ sa.Enum(name=PJSIP_TRANSPORT_METHOD_NAME).drop(
+ op.get_bind(), checkfirst=False)
+ sa.Enum(name=PJSIP_REDIRECT_METHOD_NAME).drop(
+ op.get_bind(), checkfirst=False)
diff --git a/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py b/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py
index 4a75cc98b..ecee0e04e 100644
--- a/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py
+++ b/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py
@@ -35,8 +35,8 @@ import sqlalchemy as sa
def upgrade():
op.create_table(
'extensions',
- sa.Column('id', sa.BigInteger, nullable=False, unique=True,
- autoincrement=True),
+ sa.Column('id', sa.BigInteger, primary_key=True, nullable=False,
+ unique=True, autoincrement=True),
sa.Column('context', sa.String(40), primary_key=True, nullable=False),
sa.Column('exten', sa.String(40), primary_key=True, nullable=False),
sa.Column('priority', sa.Integer, primary_key=True, nullable=False,