8 use Phinx\Migration\AbstractMigration;
11 public function up() {
13 $cuList = $this->fetchAll(
'select cu from cuadmin');
14 for ($i = 0; $i < count($cuList); $i ++) {
15 $cu = strtolower( trim( $cuList[$i][
"cu"] ) );
16 $tableRights = $this->hasTable(
"${cu}memberacctrights");
19 $sql =
"insert into ${cu}memberacctrights (user_id, accountnumber, whichright, allowed, platform) 20 select a.user_id, a.accountnumber, 'ACCESS', false, null from (select row_number() over (partition by user_id, accountnumber) as rown, user_id, accountnumber 21 from ${cu}useraccounts) a 22 left join ${cu}memberacctrights b on a.user_id = b.user_id and a.accountnumber = b.accountnumber and b.whichright = 'ACCESS' 23 where a.rown = 1 and b.user_id is null";