public function beginChangeset()
    {
        /** @var ActiveRecord $model */
        $model = $this->owner;
        $id = $model->getDb()->getSchema()->insert($this->changesetTableName, [
            'transaction_id' => new Expression('txid_current()'),
            'user_id'        => Yii::$app->user->getId(),
            'session_id'     => Yii::$app->has('session') ? Yii::$app->session->getId() : null,
            'request_date'   => date('Y-m-d H:i:s'),
            'request_url'    => Yii::$app->request instanceof \yii\web\Request ? Yii::$app->request->getUrl() : null,
            'request_addr'   => Yii::$app->request instanceof \yii\web\Request ? Yii::$app->request->getUserIP() : null,
        ]);
        $model->getDb()->createCommand('SET LOCAL audit.changeset_id = ' . reset($id))->execute();
    }