Reputation: 11
How can I generate migration to add a column in my existing model using rake
task in rails
?
The following migration should be generate using a rake
task
class AddNameToCustomer < ActiveRecord::Mirgation
def change
add_column :customer, :name, :string
end
end
Upvotes: 1
Views: 1129
Reputation: 229
namespace :dummy do
task test: :environment do
`rails generate migration AddNameToCustomers name:string`
sleep 2
`rake db:migrate`
end
end
Upvotes: 1