8 use Phinx\Migration\AbstractMigration;
11 public function up() {
13 $cuList = $this->fetchAll(
'SELECT cu FROM cuadmin');
16 foreach ($cuList as $cuRow) {
17 $cu = strtolower(trim($cuRow[
"cu"]));
18 $tableName =
"{$cu}group";
21 if ($this->hasTable($tableName)) {
22 $table = $this->table($tableName);
23 $tableColumn =
"tax_id";
26 if (!$table->hasColumn($tableColumn)) {
27 $this->query(
"ALTER TABLE {$cu}group ADD COLUMN tax_id varchar(10)");
33 public function down() {
35 $cuList = $this->fetchAll(
'SELECT cu FROM cuadmin');
38 foreach ($cuList as $cuRow) {
39 $cu = strtolower(trim($cuRow[
"cu"]));
40 $tableName =
"{$cu}group";
43 if ($this->hasTable($tableName)) {
44 $table = $this->table($tableName);
45 $tableColumn =
"tax_id";
48 if ($table->hasColumn($tableColumn)) {
49 $this->query(
"ALTER TABLE {$cu}group DROP COLUMN tax_id");