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"]));
20 $tableName =
"{$cu}memberacct";
22 if ($this->hasTable($tableName)) {
23 $table = $this->table( $tableName );
25 $hasColumn = $table->hasColumn(
'allowenroll');
30 print
"Upgrade $cu {$tableName}.\n";
33 $this->query(
"alter table $tableName add column allowenroll boolean default false");
36 print
"Skip $cu which doesn't have the member acct table.\n";
42 public function down() {
44 $cuList = $this->fetchAll(
'SELECT cu FROM cuadmin');
47 foreach ($cuList as $cuRow) {
48 $cu = strtolower(trim($cuRow[
"cu"]));
51 $tableName =
"{$cu}memberacct";
53 if ($this->hasTable($tableName)) {
54 $table = $this->table( $tableName );
55 $hasColumn = $table->hasColumn(
'allowenroll');
60 print
"Downgrade $cu {$tableName}.\n";
63 $this->query(
"alter table $tableName drop column allowenroll");
66 print
"Skip $cu which doesn't have the member acct table.\n";