final class AddPartition
    implements StandaloneCommand
    uses Snapshot
Public API: explicitly declared with @visibility public.

ADD PARTITION [NO_WRITE_TO_BINLOG] [(definitions) | PARTITIONS n]: a request to add partitions.

Mirrors PT_alter_table_add_partition, PT_alter_table_add_partition_def_list and PT_alter_table_add_partition_num: definitions for RANGE and LIST tables, a count for HASH and KEY tables, or neither. LOCAL and NO_WRITE_TO_BINLOG are synonyms. The partition values are constants. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-table-partition-operations.html.

Adding two hash partitionsdoctest
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t ADD PARTITION PARTITIONS 2');
    $alter->statement->commands[0]->count?->text // => '2'

Properties§

public list<PartitionDefinition> $definitions
public bool $local
public Numeral|null $count = null

Methods§

public function __construct(
    public bool $local,
    list<PartitionDefinition> $definitions,
    public Numeral|null $count = null,
)

Parameters

$localboolWhether NO_WRITE_TO_BINLOG or LOCAL is written
$definitionslist<PartitionDefinition>The new partitions in order
$countNumeral|nullThe PARTITIONS count, when written
Calls 3
public function deriveCommand(Derivation $derivation, Environment $scope): void

Derives the partition values as constants.

Parameters

$derivationDerivation
$scopeEnvironment
public function render(Output $out): void

Writes the action.

Parameters

$outOutput
Calls 2

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 6
Type declarations 1