Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@michaelcullum
Created October 19, 2012 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelcullum/0724fdbbe6b0afe489e8 to your computer and use it in GitHub Desktop.
Save michaelcullum/0724fdbbe6b0afe489e8 to your computer and use it in GitHub Desktop.
Why we need migrations
<?php
// What we do now
function database_update_info()
{
return array(
'3.0.10' => array(),
// No changes from 3.0.9 to 3.0.10
'3.0.11' => array(),
'add_columns' => array(
PROFILE_FIELDS_TABLE => array(
'field_show_novalue' => array('BOOL', 0),
),
),
'3.1.0' => array(),
'3.1.1' => array(
'add_columns' => array(
PROFILE_FIELDS_TABLE => array(
'field_show_novalue' => array('BOOL', 0),
),
),
);
}
<?php
// A migration file, one of these would be created every time someone changes their db (so multiple times a feature or once for a feature). Then all of these migration files that have not yet been applied (DB keeps track of migrations applied) would be applied.
class Version20121001151649 extends AbstractMigration
{
public function up(Schema $schema)
{
$this->addSql("QUERY");
}
public function down(Schema $schema)
{
$this->addSql("QUERY");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment