I suspect the error may be because the migration updates a field on the model which, in the schema revision the migration works on, hasn't actually been added yet.
If it weren't for that, I think the migration would still fail for an additional reason: as it turns out you can't add a column to a database table and then start populating that column in the same transaction. You either do it right away by setting a default, or you do it in a separate transaction. (A migration runs as a transaction, of course.)
On a final nitpick, do we know that updating every node individually and querying the tags table for each will perform sufficiently well on very large numbers of nodes?
We just hit trouble with this migration: http:// paste.ubuntu. com/7841190/
I suspect the error may be because the migration updates a field on the model which, in the schema revision the migration works on, hasn't actually been added yet.
If it weren't for that, I think the migration would still fail for an additional reason: as it turns out you can't add a column to a database table and then start populating that column in the same transaction. You either do it right away by setting a default, or you do it in a separate transaction. (A migration runs as a transaction, of course.)
On a final nitpick, do we know that updating every node individually and querying the tags table for each will perform sufficiently well on very large numbers of nodes?