PHP code example of kalel1500 / laravel-db-sync

1. Go to this page and download the library: Download kalel1500/laravel-db-sync 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/ */

    

kalel1500 / laravel-db-sync example snippets


'connections' => [
    'legacy_mysql' => [
        'driver'   => 'mysql',
        'host'     => '192.168.1.10',
        'database' => 'legacy_db',
        'username' => 'user',
        'password' => 'secret',
    ],
],

dbsync_tables.has_large_text_values_in_oracle = true

use Thehouseofel\Dbsync\Facades\DbsyncSchema;

// Safely drop a table (handles CASCADE in Oracle/Postgres/SQL Server)
DbsyncSchema::forceDrop('users');

// Truncate one or multiple tables and reset auto-incrementing IDs/Sequences
DbsyncSchema::truncate(['users', 'profiles', 'posts']);

use Thehouseofel\Dbsync\Facades\DbsyncSchema;

DbsyncSchema::connection('oracle_external')->forceDrop('legacy_table');
bash
php artisan vendor:publish --tag=dbsync-migrations
php artisan migrate
bash
php artisan dbsync:run
bash
php artisan dbsync:run --connection=1
bash
php artisan dbsync:run --table=2