Migrations: execute() and importing SQL files


I have an SQL file that I want to import in a migration. It is data
that will never change and must always be in the database for the
application (if you must know, it is a database of about 140,000
cities in the U.S.).

Originally, I did this:

cd ~/app
mysql -u root
source db/migrate/initial.db

So then I thought this would work in my migration:

def self.up
execute ‘source db/migrate/initial.db’

I assumed that I would need db/migrate because it always says
"Migrating (in /home/michael/app). Well, anyway, I ran the migration
and every time it just errors out after like the 37,000th record is
entered. Is there any limits or anything imposed on execute() that may
be causing the SQL query to be interrupted? Can I override this?


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