alembic: Correct NULLability of PJSIP id columns.

Fixes #695
pull/796/head
Sean Bright 2 years ago committed by asterisk-org-access-app[bot]
parent 3767e14d15
commit a3a0139b93

@ -0,0 +1,38 @@
"""correct nullability of pjsip id columns
Revision ID: 6c475a93f48a
Revises: 74dc751dfe8e
Create Date: 2024-04-06 09:48:33.116410
"""
# revision identifiers, used by Alembic.
revision = '6c475a93f48a'
down_revision = '74dc751dfe8e'
from alembic import op
import sqlalchemy as sa
PJSIP_TABLES = [ 'ps_aors',
'ps_auths',
'ps_domain_aliases',
'ps_endpoint_id_ips',
'ps_endpoints',
'ps_inbound_publications',
'ps_outbound_publishes',
'ps_registrations' ]
def upgrade():
for table_name in PJSIP_TABLES:
with op.batch_alter_table(table_name) as batch_op:
batch_op.alter_column('id', nullable=False,
existing_type=sa.String(255), existing_server_default=None,
existing_nullable=True)
def downgrade():
for table_name in reversed(PJSIP_TABLES):
with op.batch_alter_table(table_name) as batch_op:
batch_op.alter_column('id', nullable=True,
existing_type=sa.String(255), existing_server_default=None,
existing_nullable=True)
Loading…
Cancel
Save