I have a table which has 1 column name type (varchar 25), now I am writing Migration, adding another column named type_id (int).
What I also want is migration automatically add value for existing data based on their current value of type column. (e.g: chair = 1, table = 2, bed = 3 …..).
Is it posible to do that in Migration? Would you please write a block of code doing that please?
You can call $this->execute("custom SQL query here"); in your migration to update the data. Probably an update with a case would be appropriate? How would you do this update if you did it manually in SQL? Just do that with an execute in your migration.