Executing raw SQL in migrations?

How can I execute raw SQL statements (like ‘alter table …’) in
migrations? IIRC, AR’s execute function isn’t available, or I wasn’t
accessing it right.

Thanks,
Joe

execute should work fine - I do it all the time

Fred

execute “ALTER TABLE …”

ed

On 11/1/06, Joe R. MUDCRAP-CE [email protected]
wrote:

Posted via http://www.ruby-forum.com/.


Ed Hickey
Developer
Litmus Media
816-533-0409
[email protected]
A Member of Think Partnership, Inc
www.ThinkPartnership.com
Amex ticker symbol: THK

On 11/1/06, Joe R. MUDCRAP-CE [email protected]
wrote:

How can I execute raw SQL statements (like ‘alter table …’) in
migrations? IIRC, AR’s execute function isn’t available, or I wasn’t
accessing it right.

execute ‘alter table …’

jeremy

On 11/1/06, Joe R. MUDCRAP-CE [email protected]
wrote:

How can I execute raw SQL statements (like ‘alter table …’) in
migrations? IIRC, AR’s execute function isn’t available, or I wasn’t
accessing it right.

def self.up
s = "alter table foo…;’
execute s
end


_Deirdre http://deirdre.net/

On Wednesday 01 November 2006 23:24, Joe R. MUDCRAP-CE wrote:

How can I execute raw SQL statements (like ‘alter table …’) in
migrations? IIRC, AR’s execute function isn’t available, or I wasn’t
accessing it right.

Just call unqualified execute.

Michael


Michael S.
mailto:[email protected]
http://www.schuerig.de/michael/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs