DEV Community

roeihaviv
roeihaviv

Posted on

Changing a column name in an existing table

To change a column name in an existing table (for example: from "body" to "movie"), we should run the following command in the terminal:
rails generate migration rename_body_column_to_movie

Then, we need to run the command:
"rails db:migrate"

Then a new migration file should appear in the "migrate" folder

Top comments (0)