src/proxy/ClientTable.php
protected function prepare()
    {
        $sqlMode = null;

        if (Yii::$app->db->schema instanceof \yii\db\mysql\Schema) {
            Yii::$app->db->createCommand('SET FOREIGN_KEY_CHECKS = 0;')->execute();
            Yii::$app->db->createCommand('SET UNIQUE_CHECKS = 0;')->execute();

            $sqlMode = Yii::$app->db->createCommand('SELECT @@SQL_MODE;')->queryScalar();
            Yii::$app->db->createCommand('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";')->execute();
        }

        return $sqlMode;
    }
protected function prepare()
    {
        $sqlMode = null;

        if (Yii::$app->db->schema instanceof \yii\db\mysql\Schema) {
            Yii::$app->db->createCommand('SET FOREIGN_KEY_CHECKS = 0;')->execute();
            Yii::$app->db->createCommand('SET UNIQUE_CHECKS = 0;')->execute();

            $sqlMode = Yii::$app->db->createCommand('SELECT @@SQL_MODE;')->queryScalar();
            Yii::$app->db->createCommand('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";')->execute();
        }

        return $sqlMode;
    }
protected function prepare ( ) { $ sqlMode = null ; if ( Yii :: $ app -> db -> schema instanceof \ yii \ db \ mysql \ Schema ) { Yii :: $ app -> db -> createCommand ( 'SET FOREIGN_KEY_CHECKS = 0;' ) -> execute ( ) ; Yii :: $ app -> db -> createCommand ( 'SET UNIQUE_CHECKS = 0;' ) -> execute ( ) ; $ sqlMode = Yii :: $ app -> db -> createCommand ( 'SELECT @@SQL_MODE;' ) -> queryScalar ( ) ; Yii :: $ app -> db -> createCommand ( 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' ) -> execute ( ) ; } return $ sqlMode ; }
Prepare database for data sync and set system variables.

Disable the foreign key and unique check. Also set the sql mode to "NO_AUTO_VALUE_ON_ZERO".
Currently only for MySql and MariaDB.

@return false|null|string The old sql mode.
@throws \yii\db\Exception
@since 1.2.1
Prepare database for data sync and set system variables .