This review will focus on the PHP to generate the queries. Other reviewers may have suggestions about improving the partition process. 

# General feedback 

The code is easy to read and mostly is in line with the recommendations in the [PSR-12](https://www.php-fig.org/psr/psr-12/) style guide. The methods have good docblocks to describe the purpose and list parameters, return values and possible exceptions thrown. 

# Suggestions

### Coding Style 
[the underscore to indicate private properties and methods is a convention from PHP 4](https://stackoverflow.com/a/5766153/1575353) though [PSR-12](https://www.php-fig.org/psr/psr-12/) advises against this practice:

> ### 4.3 Properties and Constants
> 
> Visibility MUST be declared on all properties.
>
> Visibility MUST be declared on all constants if your project PHP minimum version supports constant visibilities (PHP 7.1 or later).
>
> The `var` keyword MUST NOT be used to declare a property.
> 
> There MUST NOT be more than one property declared per statement.
>
> Property names MUST NOT be prefixed with a single underscore to indicate protected or private visibility. That is, an underscore prefix explicitly has no meaning.

> ### 4.4 Methods and Functions
>
> Visibility MUST be declared on all methods.
> 
> Method names MUST NOT be prefixed with a single underscore to indicate protected or private visibility. That is, an underscore prefix explicitly has no meaning.

Also note it recommends declaring the visibility on constants when using PHP 7.1 or later- hopefully it is running on 7.3 or newer given [current LTS](https://www.php.net/supported-versions.php).

### Type declarations
Presuming the code is running PHP 7.3 or newer- [type declarations](https://www.php.net/manual/en/migration70.new-features.php) can be added for arguments and return values of methods, plus with PHP 7.4 they can be added to properties.

### Method length

Most methods are quite short and concise, though`partitionNow()` is rather long- perhaps moving the code to get the queries to sub-methods would help. Also at the end are these lines:

>       catch (Exception $e) {
>            throw $e;
>        }

If there was code to handle the exception or at least log it somewhere then it would make sense to catch it but this makes the `try/catch` seem useless. 

In the function `generateTableBackupName()` does this:

>     $backupTableAlias = 'bkp_' . date('Ymd') . '_';
>      return "{$backupTableAlias}{$tableName}";

There seems little point in creating a variable used only once - it would be simpler to merely have it be:

     return = 'bkp_' . date('Ymd') . '_' . $tableName;

### Repetitive code

The method `_getDsnAttribute()` could be simplified from the current code:

>     if ($target === 'live') {
>         if (preg_match("/{$name}=([^;]*)/", Yii::$app->getDb()->dsn, $match)) {
>             return $match[1];
>         }
>     } else {
>         if (preg_match("/{$name}=([^;]*)/", Yii::$app->db_backup->dsn, $match)) {
>             return $match[1];
>         }
>     }

The only thing that appears to be different is the second argument in the call to `preg_match()`. That difference can be stored in a variable which allows the regular expression condition to only be listed once, in turn reducing indentation levels. 

    if ($target === 'live') {
        $dsn = Yii::$app->getDb()->dsn;
    } else {
        $dsn = Yii::$app->db_backup->dsn;
    }
    if (preg_match("/{$name}=([^;]*)/", $dsn, $match)) {
        return $match[1];
    }

And the assignment of `$dsn` could be consolidated to a ternary unless that is too long for one line:

        $dsn = $target === 'live' ? Yii::$app->getDb()->dsn : Yii::$app->db_backup->dsn;

### docblock inaccuracy

The docblock for `startPartition` states that it “`@throws Exception`” however that doesn’t appear to be true since it _catches_ `Exception`s.