PHP code example of artemyurov / laravel-incremental-db-sync
1. Go to this page and download the library: Download artemyurov/laravel-incremental-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/ */
artemyurov / laravel-incremental-db-sync example snippets
return [
'default' => env('DB_SYNC_CONNECTION', 'production'),
'batch_size' => env('DB_SYNC_BATCH_SIZE', 10000),
'backup' => [
'path' => env('DB_SYNC_BACKUP_PATH', storage_path('app/db-sync/backups')),
'keep_last' => env('DB_SYNC_BACKUP_KEEP_LAST', 5),
],
'connections' => [
'production' => [
'tunnel' => env('DB_SYNC_TUNNEL', 'remote_db'),
'source' => [
'driver' => 'pgsql',
'database' => env('DB_SYNC_REMOTE_DATABASE'),
'username' => env('DB_SYNC_REMOTE_USERNAME'),
'password' => env('DB_SYNC_REMOTE_PASSWORD'),
],
'target' => env('DB_SYNC_TARGET_CONNECTION', 'pgsql'),
'excluded_tables' => [
'telescope_entries',
'sessions',
'cache',
'jobs',
],
],
],
];
bash
php artisan vendor:publish --tag=db-sync-config
bash
php artisan db-sync:pull
bash
php artisan db-sync:clone
bash
# List available backups
php artisan db-sync:restore --list
# Interactive backup selection
php artisan db-sync:restore
# Restore specific backup file
php artisan db-sync:restore backup_2025-01-15_120000.sql.gz