Forum: Ruby on Rails migration error, mysql, change column limit

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0f50b9a2ad85666d537d39bda49327ee?d=identicon&s=25 Jonathan Rochkind (jrochkind)
on 2008-11-25 22:24
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?
0f50b9a2ad85666d537d39bda49327ee?d=identicon&s=25 Jonathan Rochkind (jrochkind)
on 2008-11-25 22:45
Nevermind, as usual my own stupid error.

Jonathan Rochkind 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.)
This topic is locked and can not be replied to.