1. Reference URL: https://www.shuijingwanwq.com/2019/08/15/3427/
SQL
UPDATE `cpa_channel_app_source`, `cpa_weibo_weibo_connect_web_app_user` SET `cpa_channel_app_source`.`permission` = `cpa_weibo_weibo_connect_web_app_user`.`permission` WHERE `cpa_channel_app_source`.`id` = `cpa_weibo_weibo_connect_web_app_user`.`channel_app_source_id`;
2. Update the value of the field: permission in the table: channel_app_source to: 3, as shown in Figure 1

3. Based on the database migration command, generate the implementation of a SQL statement as shown above, and edit \console\migrations\m190815_020034_permission.php
PHP
<?php
use yii\db\Expression;
use yii\db\Migration;
/**
* Class m190815_020034_permission
*/
class m190815_020034_permission extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->update('{{%channel_app_source}}, {{%weibo_weibo_connect_web_app_user}}', ['{{%channel_app_source}}.permission' => new Expression('{{%weibo_weibo_connect_web_app_user}}.permission')], ['{{%channel_app_source}}.id' => new Expression('{{%weibo_weibo_connect_web_app_user}}.channel_app_source_id')]);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m190815_020034_permission cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m190815_020034_permission cannot be reverted.\n";
return false;
}
*/
}4. Execute the database migration command, as shown in Figure 2

Plaintext
PS E:\wwwroot\channel-pub-api> ./yii migrate
Yii Migration Tool (based on Yii v2.0.15.1)
Total 1 new migration to be applied:
m190815_020034_permission
Apply the above migration? (yes|no) [no]:yes
*** applying m190815_020034_permission
> update {{%channel_app_source}}, {{%weibo_weibo_connect_web_app_user}} ... done (time: 0.092s)
*** applied m190815_020034_permission (time: 0.190s)
1 migration was applied.
Migrated up successfully.
5. Check that the value of the field: permission in the table: channel_app_source is: 2, which meets expectations, as shown in Figure 3

