fattureincloud / pt-command-generator
Generates pt-online-schema-change commands for MySQL, given the ALTER TABLE query
0.1.0
2024-04-10 16:32 UTC
Requires
- php: >=7.4
- phpmyadmin/sql-parser: ^5.9
Requires (Dev)
- fattureincloud/php-code-standard: ^1.1
- friendsofphp/php-cs-fixer: ^3.48
- phpunit/phpunit: ^9.6
This package is auto-updated.
Last update: 2024-11-06 20:35:06 UTC
README
Generates pt-online-schema-change commands for MySQL, given the ALTER TABLE query.
⚠️ This is an experimental version. Please, do not use it in production.
Installation
composer require fattureincloud/pt-command-generator
Usage
use MadBit\PtCommandGenerator\Generator; $query = "ALTER TABLE customers ADD COLUMN middle_name VARCHAR(255) NOT NULL AFTER first_name;"; $generator = new Generator($query); $commands = $generator->getCommands(); # $commands will be an array of strings, each one representing a command to be executed # $commands[0]: pt-online-schema-change --alter "ADD COLUMN middle_name VARCHAR(255) NOT NULL AFTER first_name" h=$HOST,D=$DBNAME,t=customers,u=$DBUSERNAME,p=$DBPWD