PHP code example of fattureincloud / pt-command-generator
1. Go to this page and download the library: Download fattureincloud/pt-command-generator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fattureincloud / pt-command-generator example snippets
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