commit/galaxy-central: natefoo: Another fix for migration script 65 - the previous fix for MySQL broke PostgreSQL.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/d713ce5d01d0/ changeset: d713ce5d01d0 user: natefoo date: 2011-06-30 17:45:24 summary: Another fix for migration script 65 - the previous fix for MySQL broke PostgreSQL. affected #: 1 file (433 bytes) --- a/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py Wed Jun 29 13:27:01 2011 -0400 +++ b/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py Thu Jun 30 11:45:24 2011 -0400 @@ -10,6 +10,7 @@ from migrate.changeset import * from sqlalchemy.exc import * from galaxy.util.json import from_json_string, to_json_string +from galaxy.model.custom_types import _sniffnfix_pg9_hex import datetime now = datetime.datetime.utcnow @@ -52,14 +53,17 @@ fields = str( row[1] ) if not fields.strip(): continue - fields_list = from_json_string( fields ) + fields_list = from_json_string( _sniffnfix_pg9_hex( fields ) ) if len( fields_list ): for index, field in enumerate( fields_list ): field[ 'name' ] = 'field_%i' % index field[ 'helptext' ] = field[ 'helptext' ].replace("'", "''").replace('"', "") field[ 'label' ] = field[ 'label' ].replace("'", "''") fields_json = to_json_string( fields_list ) - cmd = "UPDATE form_definition AS f SET f.fields='%s' WHERE f.id=%i" %( fields_json, form_definition_id ) + if migrate_engine.name == 'mysql': + cmd = "UPDATE form_definition AS f SET f.fields='%s' WHERE f.id=%i" %( fields_json, form_definition_id ) + else: + cmd = "UPDATE form_definition SET fields='%s' WHERE id=%i" %( fields_json, form_definition_id ) db_session.execute( cmd ) # replace the values list in the content field of the form_values table with a name:value dict cmd = "SELECT form_values.id, form_values.content, form_definition.fields" \ @@ -121,15 +125,17 @@ cmd = "SELECT f.id, f.fields FROM form_definition AS f" result = db_session.execute( cmd ) for row in result: - og.debug("Line 124 ROW: %s" % str( row )) form_definition_id = row[0] fields = str( row[1] ) if not fields.strip(): continue - fields_list = from_json_string( fields ) + fields_list = from_json_string( _sniffnfix_pg9_hex( fields ) ) if len( fields_list ): for index, field in enumerate( fields_list ): if field.has_key( 'name' ): del field[ 'name' ] - cmd = "UPDATE form_definition AS f SET f.fields='%s' WHERE id=%i" %( to_json_string( fields_list ), form_definition_id ) + if migrate_engine.name == 'mysql': + cmd = "UPDATE form_definition AS f SET f.fields='%s' WHERE f.id=%i" %( to_json_string( fields_list ), form_definition_id ) + else: + cmd = "UPDATE form_definition SET fields='%s' WHERE id=%i" %( to_json_string( fields_list ), form_definition_id ) db_session.execute( cmd ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket