Asterisk - The Open Source Telephony Project  18.5.0
e96a0b8071c_increase_pjsip_column_size.py
Go to the documentation of this file.
1 """increase pjsip columns size
2 
3 Revision ID: e96a0b8071c
4 Revises: 3855ee4e5f85
5 Create Date: 2014-04-23 11:38:02.333786
6 
7 """
8 
9 # revision identifiers, used by Alembic.
10 revision = 'e96a0b8071c'
11 down_revision = '3855ee4e5f85'
12 
13 from alembic import op
14 import sqlalchemy as sa
15 
16 
17 def upgrade():
18  op.alter_column('ps_globals', 'user_agent', type_=sa.String(255))
19 
20  op.alter_column('ps_contacts', 'id', type_=sa.String(255))
21  op.alter_column('ps_contacts', 'uri', type_=sa.String(255))
22  op.alter_column('ps_contacts', 'user_agent', type_=sa.String(255))
23 
24  op.alter_column('ps_registrations', 'client_uri', type_=sa.String(255))
25  op.alter_column('ps_registrations', 'server_uri', type_=sa.String(255))
26 
27 
28 def downgrade():
29  op.alter_column('ps_globals', 'user_agent', type_=sa.String(40))
30 
31  if op.get_context().bind.dialect.name != 'mssql':
32  op.alter_column('ps_contacts', 'id', type_=sa.String(40))
33  else:
34  op.drop_constraint('uq_ps_contacts_id', 'ps_contacts')
35  op.drop_index('ps_contacts_id', 'ps_contacts')
36  op.alter_column('ps_contacts', 'id', type_=sa.String(40))
37  op.create_index('ps_contacts_id', 'ps_contacts', ['id'])
38  op.alter_column('ps_contacts', 'uri', type_=sa.String(40))
39  op.alter_column('ps_contacts', 'user_agent', type_=sa.String(40))
40 
41  op.alter_column('ps_registrations', 'client_uri', type_=sa.String(40))
42  op.alter_column('ps_registrations', 'server_uri', type_=sa.String(40))