def set_mysql_collation_for_column(apps, cursor, model, column, collation, schema):
 if (not hasattr(cursor.db, 'mysql_version')):
  return
 db_name = cursor.db.get_connection_params()['db']
 table_name = apps.get_model(model)._meta.db_table
 cursor.execute(("SELECT COLLATION_NAME FROM `information_schema`.`columns` WHERE TABLE_SCHEMA = '%s'  AND TABLE_NAME = '%s'  AND COLUMN_NAME = '%s';" % (db_name, table_name, column)))
 current_collation = cursor.fetchone()[0]
 if (current_collation != collation):
  cursor.execute(('ALTER TABLE `%s`.`%s` MODIFY `%s`  %s  CHARACTER SET utf8  COLLATE %s  NOT NULL;' % (db_name, table_name, column, schema, collation)))

def set_mysql_collation_for_column ( apps , cursor , model , column , collation , schema ) : if ( not hasattr ( cursor . db , 'mysql_version' ) ) : return db_name = cursor . db . get_connection_params ( ) [ 'db' ] table_name = apps . get_model ( model ) . _meta . db_table cursor . execute ( ( "SELECT COLLATION_NAME FROM `information_schema`.`columns` WHERE TABLE_SCHEMA = '%s'  AND TABLE_NAME = '%s'  AND COLUMN_NAME = '%s';" % ( db_name , table_name , column ) ) ) current_collation = cursor . fetchone ( ) [ 0 ] if ( current_collation != collation ) : cursor . execute ( ( 'ALTER TABLE `%s`.`%s` MODIFY `%s`  %s  CHARACTER SET utf8  COLLATE %s  NOT NULL;' % ( db_name , table_name , column , schema , collation ) ) )
set the collation for a mysql column if it is not set already .