Odyssey
2019062400_updateFeatureGate.php
1 <?php
2 /**
3  * Notes:
4  * 1. Anything complicated needs to be done with SQL.
5  * 2. Always have a check to know if the migration needs to occur (up or down).
6  * 3. Use up() and down(), not change(), because of the SQL
7  */
8 use Phinx\Migration\AbstractMigration;
9 
10 class UpdateFeaturegate extends AbstractMigration {
11 
12  public function up() {
13  // add column
14  $cufeaturegateTable = $this->table('cufeaturegate');
15  if ($cufeaturegateTable) {
16  $cufeaturegateTable
17  ->addColumn('params', 'string', ['comment' => 'Storage for any extra params.', 'null' => true])
18  ->update();
19  }
20  }
21 
22  public function down() {
23  // drop column
24  $cufeaturegateTable = $this->table('cufeaturegate');
25  if ($cufeaturegateTable) {
26  $cufeaturegateTable
27  ->removeColumn('params')
28  ->save();
29  }
30  }
31 }
32 ?>