I need to refactor the data model for a Rails application. This will involve consolidating two models (DB tables) into one. What would be the right way to do it? Will it be ok to delete a model? I assume, this will break previous migrations. Should I use native SQL to do the DB migrations, or rather the ActionController methods?
Share
Don’t worry about breaking previous migrations. Use the db/schema.rb or db/development_structure.sql file for importing the schema into a new database.
Go ahead and delete the models. I would use native sql (the sql code generated by Rails migrations can be very inefficient in some cases).