Rails Migration: How to increase column data type size by using ROR migration
Ruby on-RailsRubyMigrationRuby on-Rails Problem Overview
My users table login column is String type with limit of 40 characters. Now I am planning to increase the limit to 55 characters.
Any one please let me know how can we increase this limit by using ROR migration.
Thanks, Sravan
Ruby on-Rails Solutions
Solution 1 - Ruby on-Rails
class YourMigration < ActiveRecord::Migration
def up
change_column :users, :login, :string, :limit => 55
end
def down
change_column :users, :login, :string, :limit => 40
end
end
Solution 2 - Ruby on-Rails
class YourMigration < ActiveRecord::Migration
def change
change_column :users, :login, :string, :limit => 55
end
end