I wanted to add a new column:
class AddNameToUsers < ActiveRecord::Migration
def change
add_column :users, :name, :string, :first => true
end
end
I included the argument :first to place the column in front of all the others. But didn’t seem to work:
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "name"
end
Am I doing something wrong?
We can’t achieve this using migration file. but we can do the following..