Originally I wanted to use an array to keep track of image paths of product shots. I decided to replace this column with a separate 'images' table that references my 'inventory' table. This allows me to use the auto-incrementing 'image' 'id' as part of the image name in order to ensure uniqueness.
I made a migration that dropped the 'image_paths' column and then created a new 'images' table with various columns. I had a typo in the second part of the migration where I defined the new table. When I ran the migration it failed, but the 'image_paths' column was deleted. So I can't roll back because the migration was never registered. I also can't run the migration again because it will try to drop a column that doesn't exist.
Is my best bet to manually add the 'image_paths' column back in and then run the migration? Should I avoid making changes to multiple tables per migration from now on?
the best way to do it is to back up your db entries. There could be multiple fatal errors during your migration.
When you changes the column in a specific table, make sure you add everything first and then delete or remove the columns you do not want. Because removal is a rather dangerous move, you need to make sure it is done after other possible operations are done.
To further decrease the risk, you may want to separate multiple operations in different migration files. Make sure each operation is finished successfully and then move on to the next one.
Follow these rules and everything should be just fine.