Raw SQL in Migrations?

After reading AWDWR and searching the API, it appears the Rails' implementation of Migrations has no way to execute a raw SQL statement. True?

-- gw

Greg -

After reading AWDWR and searching the API, it appears the Rails' implementation of Migrations has no way to execute a raw SQL statement. True?

Simple, just use execute:

class MyMigration < ActiveRecord::Migration   def self.up     execute "alter table bar add constraint fk_bar_foo foreign key (foo_id) references foo(id)"   end

  def self.down     # ...   end end

Doh! Found it (in AWDWR not in the API docs). Funny, it uses the same execute command that I opted for when I wrote a migrations framework for Lasso :stuck_out_tongue:

-- gw