When using MySQL the changeColumn() method errors out with the following error:
Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE TEXT' at line 1
The query executed:
ALTER TABLE tablename ALTER COLUMN `columnname` TYPE TEXT;
This breaks in MySQL.
This is because the syntax of MySQL differs slightly from that of PostgreSQL in that it needs the statement to look as follows:
ALTER TABLE tablename ALTER COLUMN `columnname` `columnname` TEXT;
Alternatively, I think we should use modify instead:
ALTER TABLE tablename MODIFY `columnname` TEXT;
Since this involves the SQL generator I didn't want to bumble about in the code making changes and create a PR since I do not have the type of grasp of Model that you guys do. I think the right thing to do here is detect the driver for the specific table and then switch based on driver to generate the proper statement.
This stemmed from an attempt to change a column type in a migration for Geddy. Full information for this specific migration can be found here: https://gist.github.com/tbjers/d18be8bcc5ec270dc0d9
Fix Issue #127, MySQL generator for ALTER COLUMN
Fixed in 250ef36, pushed to NPM in v0.4.8. Thanks for catching this!