7 use Phinx\Migration\AbstractMigration;
18 $cuList = $this->fetchAll(
'SELECT cu FROM cuadmin');
20 for ( $i = 0; $i < count( $cuList ); $i++ ) {
21 $cu = strtolower( trim( $cuList[$i][
"cu"] ) );
24 $tableName =
"{$cu}extaccount";
25 $exists = $this->hasTable( $tableName );
28 print
"Adding table: $cu {$tableName}\n";
31 $sql =
"CREATE TABLE {$cu}extaccount ( 32 id SERIAL PRIMARY KEY, 33 user_id integer NOT NULL, 34 display_name varchar(20), 40 $rows = $this->query( $sql );
43 $sql =
"CREATE UNIQUE INDEX {$cu}extaccount_name_key on {$cu}extaccount USING btree ( user_id, display_name );";
44 $rows = $this->query( $sql );
47 $sql =
"COMMENT ON COLUMN {$cu}extaccount.user_id is 'User who set it up; foreign key to <cu>user.user_id';";
48 $rows = $this->query( $sql );
50 $sql =
"COMMENT ON COLUMN {$cu}extaccount.display_name is 'Name that displays in Banking';";
51 $rows = $this->query( $sql );
53 $sql =
"COMMENT ON COLUMN {$cu}extaccount.status is 'Pending/Active/Inactive flag';";
54 $rows = $this->query( $sql );
56 $sql =
"COMMENT ON COLUMN {$cu}extaccount.remote_info is 'JSON object that holds the remote account information';";
57 $rows = $this->query( $sql );
68 public function down()
71 $cuList = $this->fetchAll(
'SELECT cu FROM cuadmin');
73 for ( $i = 0; $i < count( $cuList ); $i++ ) {
74 $cu = strtolower( trim( $cuList[$i][
"cu"] ) );
77 $tableName =
"{$cu}extaccount";
78 if ( $this->hasTable( $tableName ) ) {
80 print
"Dropping $cu {$tableName}\n";
81 $this->dropTable( $tableName );