B
B
Bogdan2017-05-23 17:50:51
Ruby on Rails
Bogdan, 2017-05-23 17:50:51

Rail creating migration automatically?

Hello. Is there a possibility in Rails with the name of the migration to generate the contents of the file to change the field or remove the field? For example, if you create a migration

rails generate migration AddPriceToProducts price:decimal{15,5}

then the file will be automatically created
add_column :products, :price, :decimal, precision: 15, scale: 5

And it is possible also to create for removal or change of a field? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Bordenyuk, 2017-05-23
@HighQuality

Removal? Certainly.

rails g migration remove_category_id_from_posts category_id:integer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question