|
|
|
|
@ -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)
|
|
|
|
|
|