Is there a suggested approach to altering the field schema for already populated fields? I specifically wish to solve this problem http://drupal.org/node/1514826#comment-5866494.

Currently the fivestar module's field schema looks like this:

&lt;?php
 function fivestar_field_schema() {
  return array(
    'columns' =&gt; array(
      'rating' =&gt; array(
        'type' =&gt; 'int', 
        'unsigned' =&gt; TRUE, 
        'not null' =&gt; FALSE, 
        'sortable' =&gt; TRUE,
      ), 
      'target' =&gt; array(
        'type' =&gt; 'int', 
        'unsigned' =&gt; TRUE, 
        'not null' =&gt; FALSE,
      ),
    ),
  );
}
?&gt;


I would like to change it to:

&lt;?php
 function fivestar_field_schema() {
  return array(
    'columns' =&gt; array(
      'rating' =&gt; array(
        'type' =&gt; 'float', // Change to float from int
        'unsigned' =&gt; TRUE, 
        'not null' =&gt; FALSE, 
        'sortable' =&gt; TRUE,
      ), 
      'target' =&gt; array(
        'type' =&gt; 'int', 
        'unsigned' =&gt; TRUE, 
        'not null' =&gt; FALSE,
      ),
    ),
  );
}
?&gt;


This would work for new Fivestar fields. However, those that contain data cannot be updated. Since the field storage can be in SQL or Mongo or Solr, I would like to create a generic update to this. However, the most commonly used sql storage does not allow column changes if it has data (see field_sql_storage_field_storage_update_field()).

Is there a suggested way out? Thanks.
I have no idea if this is a "suggested way out," I'm tending to think not, but, with your site offline, you should be able to use phpmyadmin and:


Add a field to the database table (your float field),
copy all of the data from the original column/field to this new one (something as simple as UPDATE "tablename" SET "newfield" = "oldfield" would probably do it),
drop the original integer field from the table,
rename the new field with the old field's name, and


then take drupal online with the new schema and code that is expecting a float in there instead of an integer.

You could also just rename instead of dropping the original field so you could quickly go back if this screwed up, but I would definitely back things up before trying this in any case :)