#NEWLINE# def downgrade( migrate_engine ) : #NEWLINE# #INDENT# meta . bind = new_state_desc #NEWLINE# instance_table = Table ( 'instances' , meta , autoload = True , autoload_with = migrate_engine ) #NEWLINE# c_task_state = instance_table . c . task_state #NEWLINE# c_state = instance_table . c . power_state #NEWLINE# c_state . alter ( name = 'state' ) #NEWLINE# c_vm_state = instance_table . c . vm_state #NEWLINE# c_vm_state . alter ( name = 'state_description' ) #NEWLINE# for ( old_vm_state , old_task_states ) in _downgrade_translations . iteritems ( ) : #NEWLINE# #INDENT# for ( old_task_state , new_state_desc ) in old_task_states . iteritems ( ) : #NEWLINE# #INDENT# instance_table . update ( ) . where ( ( c_task_state == old_task_state ) ) . where ( ( c_vm_state == old_vm_state ) ) . values ( vm_state = new_state_desc ) . execute ( ) #NEWLINE# #UNINDENT# #UNINDENT# instance_table . drop_column ( 'task_state' )