database
(If you missed it, my previous post on this topic was Using Doctrine Migrations Without the ORM.)
So my previous blog post laid down a good start on how to use Doctrine to move changes to the database, but soon I ran into a new problem - what about when you have data to change in addition to changing the structure of the database? For instance, my first try at this was putting a default row of data into a new table, or maybe putting initial data into a new column?
My first try was simple, but unfortunately not quite right, I used the addSql() command:
<?php
class Version20140828145153 extends AbstractMigration
{
public function up(Schema $schema) {
<code that creates a new table>
$this->addSql("INSERT INTO <table> (this, that, theother) VALUES (...)");
}
...
?>
Recently I was handed a PHP project at work which already existed but the owner wanted a variety of tweaks and improvements added to it. The project wasn't built with any framework I could name, and although it has a sort of MVC feel to it, is not strictly an MVC project.