Forum: Ruby on Rails Running SQL file from inside rake task

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
2119f016588ba13373484491bd2dd6d1?d=identicon&s=25 Joe Peck (fatcatt316)
on 2008-10-16 20:57
My friends,

I have a rake task that I'm running to initialize some stuff for new

I need to run a SQL file from inside that rake task.  It's just a big,
raw SQL file.

How can I run the SQL file from inside the rake task?

Thanks in advance for any good advice.
4c438a80fc30661ad619ea177cf9cbd0?d=identicon&s=25 Freddy Andersen (Guest)
on 2008-10-16 22:20
(Received via mailing list)
`mysql -uroot databasename < sqlfile.sql`
6fabb84e727dee98d1277df56458cbac?d=identicon&s=25 Andrew Bloom (Guest)
on 2008-10-17 01:12
(Received via mailing list)
ActiveRecord::Base.connection.execute( <file contents here> )
This topic is locked and can not be replied to.