'connections' => [
'zero-downtime' => [
'driver' => 'gh-ost',
// This is your master write access database connection details
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
// Additional options, depending on your setup
// all options available here: https://github.com/github/gh-ost/blob/master/doc/cheatsheet.md
'params' => [
'--max-load=Threads_running=25',
'--critical-load=Threads_running=1000',
'--chunk-size=1000',
'--throttle-control-replicas=myreplica.1.com,myreplica.2.com',
'--max-lag-millis=1500',
'--verbose',
'--switch-to-rbr',
'--exact-rowcount',
'--concurrent-rowcount',
'--default-retries=120',
],
],
],
'connections' => [
'zero-downtime' => [
'driver' => 'pt-online-schema-change',
// This is your master write access database connection details
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
// Additional options, depending on your setup
// all options available here: https://www.percona.com/doc/percona-toolkit/LATEST/pt-online-schema-change.html
'params' => [
'--nocheck-replication-filters',
'--nocheck-unique-key-change',
'--recursion-method=none',
'--chunk-size=2000',
],
],
],
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Daursu\ZeroDowntimeMigration\ZeroDowntimeSchema;
class AddPhoneNumberToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
ZeroDowntimeSchema::table('users', function (Blueprint $table) {
$table->string('phone_number')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
ZeroDowntimeSchema::table('users', function (Blueprint $table) {
$table->dropColumn('phone-number');
});
}
}