migrations as $migration_class) { $migration = Yii::createObject($migration_class); if ($migration instanceof BaseObject && $migration->canSetProperty('compact')) { $migration->compact = $this->compact; } if ($migration->up() === false) { return false; } } $new_type = $this->integer()->notNull(); if ($this->db->driverName === 'pgsql') { $new_type = $new_type->append('USING CAST(user_id AS integer)'); $this->dropPrimaryKey('rbac_auth_assignment_pkey', '{{%rbac_auth_assignment}}'); } $this->alterColumn('{{%rbac_auth_assignment}}', 'user_id', $new_type); if ($this->db->driverName === 'pgsql') { $this->addPrimaryKey('rbac_auth_assignment_pkey', '{{%rbac_auth_assignment}}', ['item_name', 'user_id']); } return true; } public function safeDown() { if ($this->db->driverName === 'pgsql') { $this->dropPrimaryKey('rbac_auth_assignment_pkey', '{{%rbac_auth_assignment}}'); } $this->alterColumn('{{%rbac_auth_assignment}}', 'user_id', $this->string(64)->notNull()); if ($this->db->driverName === 'pgsql') { $this->addPrimaryKey('rbac_auth_assignment_pkey', '{{%rbac_auth_assignment}}', ['item_name', 'user_id']); } foreach ($this->migrations as $migration_class) { $migration = Yii::createObject($migration_class); if ($migration instanceof BaseObject && $migration->canSetProperty('compact')) { $migration->compact = $this->compact; } if ($migration->down() === false) { return false; } } return true; } }