Disabling FOREIGN KEYs in a Rake task

Hi,

How could I disable my database FOREIGN KEYs in a Rake task?
Or, how could I call the execute() method in a Rake task?

I’m trying to perform something like:

task :delete_the_cippalippa => :environment do
require RAILS_ROOT+’/lib/marsian.rb’
# FIXME: execute() is undefined
execute “SET FOREIGN_KEY_CHECKS = 0”
Cippalippa.delete(-1)
[…some more code…]
# FIXME: as above
execute “SET FOREIGN_KEY_CHECKS = 1”
end

Thanks.

Cheers,
Marco

On May 8, 2006, at 5:54 PM, Marco L. wrote:

[..some more code..]
# FIXME: as above
execute "SET FOREIGN_KEY_CHECKS = 1"

end

ActiveRecord::Base.connection.execute ‘…’

Cheers,
jeremy

On 09/05/06, Jeremy K. [email protected] wrote:

How could I disable my database FOREIGN KEYs in a Rake task?
Or, how could I call the execute() method in a Rake task?

ActiveRecord::Base.connection.execute ‘…’

Thanks Jeremy. It works perfectly!

Marco