Skip to content

Instantly share code, notes, and snippets.

@kasimi
Created October 11, 2017 16:29
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 kasimi/00291a408fb175359b6854f312541cf4 to your computer and use it in GitHub Desktop.
Save kasimi/00291a408fb175359b6854f312541cf4 to your computer and use it in GitHub Desktop.
phpBB 3.2.1 revert migrations
<?php
class m1_initial_schema extends \phpbb\db\migration\migration
{
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'test_table' => array(
'COLUMNS' => array(
'test_id' => array('UINT', null, 'auto_increment'),
'some_numbr' => array('UINT', 0),
),
'PRIMARY_KEY' => 'test_id',
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'test_table',
),
);
}
}
class m2_schema_fix extends \phpbb\db\migration\migration
{
public static function depends_on()
{
return array(
'\kasimi\above\migrations\m1_initial_schema',
);
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'test_table' => array(
'some_numbr',
),
),
'add_columns' => array(
$this->table_prefix . 'test_table' => array(
'some_number' => array('UINT', 0),
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'test_table' => array(
'some_numbr' => array('UINT', 0),
),
),
'drop_columns' => array(
$this->table_prefix . 'test_table' => array(
'some_number',
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment