Rails Best Practices 5: Optimize Migration

Logo devnterface d88f51727b3053dd3115e1ef9c566ad79b4c2edb3cd208c06345fc37058bebd9

Migrations, in my opinion, are one of the best things in Rails since these allow the creation and populating the database using ruby code without having to worry about which type of db run below. That said, even writing the migration is better to follow some best practices. 1. DB Index The first practice I strongly recommend is to define indices for the external keys and for all those columns on which you will make sort, search and groups. Let’s take a samp...

Read more