I am trying to do a migration of a column in a table in my database. I have a ‘name’ field and I want to migrate all the info in the name field to a ‘user_name’ field. What is the correct way in ruby on rails to copy the values of one column in the user table to another column in the same table?
Share
Add the column
and then run an update script (in a db console or via
executein a migration file)Or, if you don’t want to keep the old column, you can just rename it.