Why can't I run a Rake task inside my migration?

What error is coming back from the database? How are you executing the rake task? When you're running a migration, you are running a rake task.

Robby

Robby Russell wrote:

..When you're running a migration, you are running a rake

task.

Which is exactly why I'm so puzzled. The postgres adapter gets a problem when trying to get the data structure for a table, it fails on this query

SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull               FROM pg_attribute a LEFT JOIN pg_attrdef d                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum              WHERE a.attrelid = 'territories'::regclass                AND a.attnum > 0 AND NOT a.attisdropped              ORDER BY a.attnum

Which isn't going to tell you very much.

I've got no time to dig down into the depths of the postresql adapter and I can work with the problem by running the rake task outside of a migration. I was just hoping to be able to package everything up inside a single call to rake db:migrate, obviously not.

Ta

John Small

By chance are you attempting to add a new table for a new model? (and then trying to add some data to populate it?)

Robby