开发者

Heroku - Migration failing, how to change migration to run on Heroku?

开发者 https://www.devze.com 2023-03-11 06:42 出处:网络
I\'ve got a migration file which does the following: class ChangeLoginToUsername < ActiveRecord::Migration

I've got a migration file which does the following:

class ChangeLoginToUsername < ActiveRecord::Migration
  def self.up
    rem开发者_开发百科ove_column :users, :login, :string
    add_column :users, :username, :string
  end

  def self.down
    remove_column :users, :username, :string
    add_column :users, :login, :string
  end
end

This ran in fine on my local dev but I've now noticed the third parameter for the filed type on remove_column is erroring when I try and run this migration on Heroku. Is there a way to write/run specific migrations just for Heroku? There are 2 further migrations after this one that I need to run...

Any help hugely appreciated as always


It doesn't make sense for remove_column to have a data type:

class ChangeLoginToUsername < ActiveRecord::Migration
  def self.up
    remove_column :users, :login
    ....
  end

  def self.down
    remove_column :users, :username
    ...
  end
end
0

精彩评论

暂无评论...
验证码 换一张
取 消