Migration error, mysql, change column limit


#1

Hmm, one of my migrations have stopped working on #down. It still works
on #up. (It’s also possible that I never tested it for #down before, and
it never worked, heh.)

I can’t figure out why not. Pretty simple.

class WidenRequestParams < ActiveRecord::Migration
def self.up
change_column :requests, :params, :string, :limit => 2048
end

def self.down
change_column :requests, :params, :string, :limit => 1024
end
end

Up works fine. Down tells me:

Mysql::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 ‘limit1024 DEFAULT NULL’ at line 1: ALTER TABLE requests
CHANGE params params limit1024 DEFAULT NULL

Why is it messing up the SQL on ‘down’, but not ‘up’? Very weird.
Anyone have any ideas?


#2

Nevermind, as usual my own stupid error.

Jonathan R. wrote:

Hmm, one of my migrations have stopped working on #down. It still works
on #up. (It’s also possible that I never tested it for #down before, and
it never worked, heh.)