From: George Joseph Date: Tue, 9 Jul 2024 02:07:25 +0000 (-0600) Subject: ast-db-manage: Remove duplicate enum creation X-Git-Tag: 21.4.0-rc1~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ba2317472d9c027c47fbab97f4fb726c62f2337;p=thirdparty%2Fasterisk.git ast-db-manage: Remove duplicate enum creation Remove duplicate creation of ast_bool_values from 2b7c507d7d12_add_queue_log_option_log_restricted_.py. This was causing alembic upgrades to fail since the enum was already created in fe6592859b85_fix_mwi_subscribe_replaces_.py back in 2018. Resolves: #797 (cherry picked from commit af580848559b5a8e7516660555442a29fff4c6ef) --- diff --git a/contrib/ast-db-manage/config/versions/2b7c507d7d12_add_queue_log_option_log_restricted_.py b/contrib/ast-db-manage/config/versions/2b7c507d7d12_add_queue_log_option_log_restricted_.py index f85e998932..919d462445 100644 --- a/contrib/ast-db-manage/config/versions/2b7c507d7d12_add_queue_log_option_log_restricted_.py +++ b/contrib/ast-db-manage/config/versions/2b7c507d7d12_add_queue_log_option_log_restricted_.py @@ -20,15 +20,11 @@ AST_BOOL_VALUES = [ '0', '1', 'false', 'true', 'no', 'yes' ] - def upgrade(): - # Create the new enum + # ast_bool_values have already been created, so use postgres enum object + # type to get around "already created" issue - works okay with mysql ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False) - if op.get_context().bind.dialect.name == 'postgresql': - ast_bool_values.create(op.get_bind(), checkfirst=False) - op.add_column('queues', sa.Column('log_restricted_caller_id', ast_bool_values)) - def downgrade(): op.drop_column('queues', 'log_restricted_caller_id')