Custom DML and schema.rb

Cross post from Stack Overflow (

)

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)

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 ?