Tweak Data in Doctrine Migration (say, by running some arbitrary queries)

Posted by timdev on Stack Overflow See other posts from Stack Overflow or by timdev
Published on 2010-03-15T20:07:03Z Indexed on 2010/03/15 20:09 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

I've got a migration that creates a couple of columns that act as foreign keys. In particular, I'm adding a creator_id and owner_id column to a model. These foreign keys indicate who created, and who currently owns, a particular kind of domain object. Users are managed by sfDoctrineGuardPlugin.

What I'd like to do, for the purpose of the migration, is look up the (active) user with the lowest id, and default creator_id/owner_id to that.

I don't see any particularly obvious/proper way to run arbitrary operations on the database during a migration.

Does anyone know how?

© Stack Overflow or respective owner

Related posts about php

Related posts about symfony