Asterisk - The Open Source Telephony Project GIT-master-abe0018
6c475a93f48a_correct_nullability_of_pjsip_id_columns.py
Go to the documentation of this file.
1"""correct nullability of pjsip id columns
2
3Revision ID: 6c475a93f48a
4Revises: d5122576cca8
5Create Date: 2024-04-06 09:48:33.116410
6
7"""
8
9# revision identifiers, used by Alembic.
10revision = '6c475a93f48a'
11down_revision = 'd5122576cca8'
12
13from alembic import op
14import sqlalchemy as sa
15
16PJSIP_TABLES = [ 'ps_aors',
17 'ps_auths',
18 'ps_domain_aliases',
19 'ps_endpoint_id_ips',
20 'ps_endpoints',
21 'ps_inbound_publications',
22 'ps_outbound_publishes',
23 'ps_registrations' ]
24
25def upgrade():
26 for table_name in PJSIP_TABLES:
27 with op.batch_alter_table(table_name) as batch_op:
28 batch_op.alter_column('id', nullable=False,
29 existing_type=sa.String(255), existing_server_default=None,
30 existing_nullable=True)
31
32
34 for table_name in reversed(PJSIP_TABLES):
35 with op.batch_alter_table(table_name) as batch_op:
36 batch_op.alter_column('id', nullable=True,
37 existing_type=sa.String(255), existing_server_default=None,
38 existing_nullable=True)