Asterisk - The Open Source Telephony Project GIT-master-f36a736
f5b0e7427449_add_loop_last_to_res_musiconhold.py
Go to the documentation of this file.
1"""Add loop_last to res_musiconhold
2
3Revision ID: f5b0e7427449
4Revises: 4042a0ff4d9f
5Create Date: 2023-03-13 23:59:00.835055
6
7"""
8
9# revision identifiers, used by Alembic.
10revision = 'f5b0e7427449'
11down_revision = '4042a0ff4d9f'
12
13from alembic import op
14import sqlalchemy as sa
15from sqlalchemy.dialects.postgresql import ENUM
16
17YESNO_NAME = 'yesno_values'
18YESNO_VALUES = ['yes', 'no']
19
20def upgrade():
21 yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
22 op.add_column('musiconhold', sa.Column('loop_last', yesno_values))
23
25 if op.get_context().bind.dialect.name == 'mssql':
26 op.drop_constraint('musiconhold','loop_last')
27 op.drop_column('musiconhold', 'loop_last')