Cross post from Stack Overflow ( http://stackoverflow.com/questions/11894180/how-does-one-correctly-add-custom-sql-dml-in-migrations ) I had a situation today where I wanted to add a partial postgres index to a table in a migration. Naturally this kind of stuff is not possible yet in rails using `add_index` (it is [coming some time][1]) So, I am forced to use `execute` statements in my migration. Now, `schema.rb` has this comment at the top: # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you''ll amass, the slower it''ll run and the greater likelihood for issues). # Unfortunately this `execute` statement is not tracked in `schema.rb` the effect of this is making `schema.rb` pretty much useless if I have any custom DML. Is there any way I can force an `execute` statement containing DML to find itself into `schema.rb` ? [1]: https://github.com/rails/rails/commit/d70e0236df61d69c9299fe63df94da35c87ee2d8 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/9C7E6YUU094J. For more options, visit https://groups.google.com/groups/opt_out.