<s> from migrate import ForeignKeyConstraint <EOL> from sqlalchemy import Column , MetaData , Table <EOL> from sqlalchemy import String <EOL> from rack . openstack . common . gettextutils import _ <EOL> from rack . openstack . common import log as logging <EOL> LOG = logging . getLogger ( __name__ ) <EOL> meta = MetaData ( ) <EOL> processes_securitygroups = Table ( '<STR_LIT>' , meta , <EOL> Column ( <EOL> '<STR_LIT>' , String ( length = <NUM_LIT> ) , nullable = False , <EOL> primary_key = True ) , <EOL> Column ( <EOL> '<STR_LIT>' , String ( length = <NUM_LIT> ) , <EOL> nullable = False , primary_key = True ) , <EOL> mysql_engine = '<STR_LIT>' , <EOL> mysql_charset = '<STR_LIT:utf8>' <EOL> ) <EOL> def upgrade ( migrate_engine ) : <EOL> meta . bind = migrate_engine <EOL> processes = Table ( "<STR_LIT>" , meta , autoload = True ) <EOL> securitygroups = Table ( "<STR_LIT>" , meta , autoload = True ) <EOL> try : <EOL> processes_securitygroups . create ( ) <EOL> except Exception : <EOL> LOG . info ( repr ( processes_securitygroups ) ) <EOL> LOG . exception ( <EOL> _ ( '<STR_LIT>' ) ) <EOL> raise <EOL> ForeignKeyConstraint ( columns = [ processes_securitygroups . c . pid ] , <EOL> refcolumns = [ processes . c . pid ] ) . create ( ) <EOL> ForeignKeyConstraint ( <EOL> columns = [ processes_securitygroups . c . securitygroup_id ] , <EOL> refcolumns = [ securitygroups . c . securitygroup_id ] ) . create ( ) <EOL> def downgrade ( migrate_engine ) : <EOL> meta . bind = migrate_engine <EOL> try : <EOL> processes_securitygroups . drop ( ) <EOL> except Exception : <EOL> LOG . info ( repr ( processes_securitygroups ) ) <EOL> LOG . exception ( <EOL> _ ( '<STR_LIT>' ) ) <EOL> raise </s>
