Fork me on GitHub

migration

    Optimize db migration

    30 Oct 2011

    Richard Huang

    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. Read More

    Tags 


    Use say and say_with_time in migrations to make a useful migration log

    19 Aug 2010

    Guillermo Álvarez Fernández

    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 Read More

    Tags 


    Double-check your migrations

    26 Jul 2010

    Jaime Iniesta

    When you generate a new migration, try it forwards and backwards to ensure it has no errors Read More

    Tags 


    Isolating Seed Data

    24 Jul 2010

    Wen-Tien Chang

    Rails 2.3.4 provides db:seed task that is the best way to insert seed data for set up a new application. Read More

    Tags 


    Always add DB index

    24 Jul 2010

    Wen-Tien Chang

    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. Read More

    Tags