mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 19:38:22 +00:00
Merge "alembic: Fix use_callerid_contact option add script." into 13
This commit is contained in:
@@ -24,19 +24,16 @@ AST_BOOL_VALUES = [ '0', '1',
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# Create the new enum
|
############################# Enums ##############################
|
||||||
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)
|
|
||||||
|
|
||||||
|
# ast_bool_values has 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)
|
||||||
|
|
||||||
op.add_column('ps_globals', sa.Column('use_callerid_contact', ast_bool_values))
|
op.add_column('ps_globals', sa.Column('use_callerid_contact', ast_bool_values))
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
if op.get_context().bind.dialect.name == 'mssql':
|
if op.get_context().bind.dialect.name == 'mssql':
|
||||||
op.drop_constraint('ck_ps_globals_use_callerid_contact_ast_bool_values','ps_globals')
|
op.drop_constraint('ck_ps_globals_use_callerid_contact_ast_bool_values', 'ps_globals')
|
||||||
op.drop_column('ps_globals', 'use_callerid_contact')
|
op.drop_column('ps_globals', 'use_callerid_contact')
|
||||||
|
|
||||||
if op.get_context().bind.dialect.name == 'postgresql':
|
|
||||||
ENUM(name=AST_BOOL_NAME).drop(op.get_bind(), checkfirst=False)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user