Odyssey
2019090600_fixFeatureGateParams.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 fixFeatureGateParams extends AbstractMigration {
11 
12  public function up() {
13  // add column
14  $cufeaturegateTable = $this->table('cufeaturegate');
15  if ($cufeaturegateTable) {
16 
17  if ($cufeaturegateTable->hasColumn('params')) {
18  print "Altering params column.\n";
19  $this->query("ALTER TABLE cufeaturegate ALTER COLUMN params TYPE text");
20  }
21  }
22  }
23 
24  public function down() {
25  // don't care about going backwards
26  }
27 }
28 ?>