I have a Rake task which I’ve developed as part of a set of data
migrations. The task has to be run after a particular migration has run.
The migration changes the table structure and then the Rake task comes
in and plays with the data.
So the obvious thing is to invoke the Rake task at the end of the table
structure changes in the migration. But if I do that then I get an error
coming back from the database. It’s an error from Postgresql, but I
don’t get the error if I run the Rake task from the command line. Is
there something that’s going on inside the migration which might change
the way a Rake task would work. The only thing I can see is that in a
migration it’s inside a transaction, but I can’t see why that would give
me an error.