8 use Phinx\Migration\AbstractMigration;
11 public function up() {
13 $cuList = $this->fetchAll(
'SELECT cu FROM cuadmin');
15 foreach ($cuList as $cuRow) {
16 $cu = strtolower(trim($cuRow[
"cu"]));
17 $tableName =
"{$cu}transhdr";
20 if ($this->hasTable($tableName)) {
21 $table = $this->table($tableName);
22 $tableColumn =
"transmeta";
25 if (!$table->hasColumn($tableColumn)) {
26 $this->query(
"ALTER TABLE $tableName ADD COLUMN $tableColumn varchar");
32 public function down() {
34 $cuList = $this->fetchAll(
'SELECT cu FROM cuadmin');
36 foreach ($cuList as $cuRow) {
37 $cu = strtolower(trim($cuRow[
"cu"]));
38 $tableName =
"{$cu}transhdr";
41 if ($this->hasTable($tableName)) {
42 $table = $this->table($tableName);
43 $tableColumn =
"transmeta";
46 if ($table->hasColumn($tableColumn)) {
47 $this->query(
"ALTER TABLE $tableName DROP COLUMN $tableColumn");