~singpolyma/asterisk

ref: 130ba7aeba07eb8bb3ea34418ca458bb58b05080 asterisk/contrib/ast-db-manage/config/versions/e96a0b8071c_increase_pjsip_column_size.py -rw-r--r-- 1.4 KiB
130ba7ae — Bernhard Schmidt Import asterisk_16.2.1~dfsg.orig.tar.xz 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""increase pjsip columns size

Revision ID: e96a0b8071c
Revises: 3855ee4e5f85
Create Date: 2014-04-23 11:38:02.333786

"""

# revision identifiers, used by Alembic.
revision = 'e96a0b8071c'
down_revision = '3855ee4e5f85'

from alembic import op
import sqlalchemy as sa


def upgrade():
    op.alter_column('ps_globals', 'user_agent', type_=sa.String(255))

    op.alter_column('ps_contacts', 'id', type_=sa.String(255))
    op.alter_column('ps_contacts', 'uri', type_=sa.String(255))
    op.alter_column('ps_contacts', 'user_agent', type_=sa.String(255))

    op.alter_column('ps_registrations', 'client_uri', type_=sa.String(255))
    op.alter_column('ps_registrations', 'server_uri', type_=sa.String(255))


def downgrade():
    op.alter_column('ps_globals', 'user_agent', type_=sa.String(40))

    if op.get_context().bind.dialect.name != 'mssql':
        op.alter_column('ps_contacts', 'id', type_=sa.String(40))
    else:
        op.drop_constraint('uq_ps_contacts_id', 'ps_contacts')
        op.drop_index('ps_contacts_id', 'ps_contacts')
        op.alter_column('ps_contacts', 'id', type_=sa.String(40))
        op.create_index('ps_contacts_id', 'ps_contacts', ['id'])
    op.alter_column('ps_contacts', 'uri', type_=sa.String(40))
    op.alter_column('ps_contacts', 'user_agent', type_=sa.String(40))

    op.alter_column('ps_registrations', 'client_uri', type_=sa.String(40))
    op.alter_column('ps_registrations', 'server_uri', type_=sa.String(40))