10

I just started learning Phinx, and I am needing to change the collation of a column to latin1_swedish_ci. I'm not finding documentation on how to do this. I'm assuming it would be similar to:

->addColumn('text_two', 'string', ['collation' => 'latin1_swedish_ci'])

However, I have seen some talk that this feature wasn't implemented yet. https://github.com/robmorgan/phinx/issues/661

If anyone has any ways around this, that would be great!

hjcoder18
  • 449
  • 1
  • 5
  • 13

1 Answers1

9

This feature has been implemented as of 0.7.0.

To change the collation of an existing column foo in the table bar to latin1_swedish_ci, it would look like this:

$this->table('bar')
    ->changeColumn('foo', 'string', array(
        'collation' => 'latin1_swedish_ci',
    ))
    ->update();
AlbinoDrought
  • 986
  • 17
  • 24