1. Go to this page and download the library: Download clouddueling/auto-migrate 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/ */
clouddueling / auto-migrate example snippets
$params = array(
'dbuser' => 'root',
'dbpass' => 'root',
'dbname' => 'database',
'dbhost' => 'localhost'
);
try {
$diff = new MySQLDiff($params);
} catch(Exception $e) {
echo $e->getMessage(); exit;
}
// This returns an array of what's missing in the database
try {
$diff_lines = $diff->getDiffs();
var_dump($diff_lines);
catch(Exception $e) {
echo $e->getMessage(); exit;
}
// This returns SQL queries which can be run to fix the database
try {
$diff_lines = $diff->getSQLDiffs();
var_dump($diff_lines);
} catch(Exception $e) {
echo $e->getMessage(); exit;
}
// This generates the SQL and actually runs all of them
try {
$diff_lines = $diff->runSQLDiff();
var_dump($diff_lines);
} catch(Exception $e) {
echo $e->getMessage(); exit;
}