Skip to content
Snippets Groups Projects
Commit 466607da authored by George Joseph's avatar George Joseph Committed by Gerrit Code Review
Browse files

Merge "alembic: Fix use_callerid_contact option add script." into 13

parents 5567f618 c81ffa9e
No related branches found
No related tags found
No related merge requests found
......@@ -24,19 +24,16 @@ AST_BOOL_VALUES = [ '0', '1',
def upgrade():
# Create the new enum
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)
############################# Enums ##############################
# 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))
def downgrade():
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')
if op.get_context().bind.dialect.name == 'postgresql':
ENUM(name=AST_BOOL_NAME).drop(op.get_bind(), checkfirst=False)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment