Tag migration
10 votes
8 comments
6941 views
Rails 2.3.4 provides db:seed task that is the best way to insert seed data for set up a new application.
implemented13 votes
12 comments
10416 views
Always add index for foreign key, columns that need to be sorted, lookup fields and columns that are used in a GROUP BY. This can improve the performance for sql query. If you're not sure which column need to index , I recommend to use http://github.com/eladmeidar/rails_indexes, which provide rake tasks to find missing indexes.
implemented27 votes
4 comments
3319 views
When you generate a new migration, try it forwards and backwards to ensure it has no errors
14 votes
1 comments
4318 views
Use say and say_with_time in migrations to make a useful migration log
Use say_with_time and say in migrations will produce a more readable output in migrations. And if use correctly it could be a helpful friend when something goes wrong because normally it is stored in the deploy log
implemented3 votes
4 comments
7567 views
rails migration provides a convenient way to alter database structure, you can easily add, change and drop column to a existing table, but when the data in existing table are huge, it will take a long time to alter existing table, you should try to merge/optimize the db alter sql statements.
