I have a Symfony project that is using the DoctrineMigrations bundle, and I have a really simple question: When I run a migration (e.g., when I'm pushing an update to production), how can I insert data to the database?
For example: I have an Entity which is the type of an add. The entity is:
private $addType; // String
private $type1; // Boolean
private $type2; // Boolean
private $type3; // Boolean
I add another field ($type4
), and I want to add a new record to the database, with this values:
$addType = 'Type number 4';
$type1 = false;
$type2 = false;
$type3 = false;
$type4 = true;
How can this be done with DoctrineMigrations? Is it possible?
$type4
) to your entity, and you want to insert a default value (true
) into the database for this property and its underlying db column. Is this accurate? – Heptagon$this->connection->executeQuery('INSERT INTO add (foo, bar) VALUES ('a', 'b')
in your migrations. I have no idea if it is possible to use the ORM layer in migrations, assuming this is what you want to do. – Heptagonfixtures:load
command (I don't remember if it's exactly this command), the database is purged... And I don't want to purge the production database each time I install an update... EDIT: There is a flag (--append
) to not purge the database, but this way you charge ALL the fixtures, not only the new ones... – Oldwife