devroshan / dbsync
Syncing data in distributed offline system.
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.1.3
- doctrine/dbal: ~2.3
- intervention/imagecache: ~2.3.3|^2.4
- laravel/framework: ^5.7|^5.8|^6.0|^7.0
- webpatser/laravel-uuid: ^3.0
This package is auto-updated.
Last update: 2025-03-07 00:30:52 UTC
README
composer require devroshan/dbsync
For fresh laravel project only To change your primary key from integer to uuid
php artisan dbsync:convert_to_uuid
For existing project
php artisan dbsync:install
publish vendor files
php artisan vendor:publish --tag='dbsync'
Create Symlink of storage
php artisan storage:link
Place these thing in all your model
=> use App\Uuids;
(import this at top)
Inside model class add these
use Uuids; public $incrementing = false; protected $keyType= "string";
And in your blade file
@include('dbsync::export')
@include('dbsync::import')
Note: For Import :it import data of env DB_CONNECTION connected database.
For Export :place one variable name DB_CONNECTION_2 as
DB_CONNECTION_2=pgsql2
and in config/database.php configure connection for the database to import or sync
'pgsql2' => [ 'driver' => 'pgsql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '5432'), 'database' => 'database_name', 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, 'schema' => 'public', 'sslmode' => 'prefer', ],