dcblogdev/laravel-db-sync

There is no license information available for the latest version (v1.0.3) of this package.

Sync database down.

Fund package maintenance!
dcblogdev

v1.0.3 2022-06-26 17:14 UTC

This package is auto-updated.

Last update: 2022-06-26 18:04:55 UTC


README

DB Dync

Introduction

Sync remote database to a local database

Connection can be made over SSH or using a remote MySQL connection.

Install

Install the package.

composer require dcblogdev/laravel-db-sync

Config

You can publish the config file with:

php artisan vendor:publish --provider="Dcblogdev\DbSync\DbSyncServiceProvider" --tag="config"

.env

Set the remote database credentials in your .env file

When using SSH Add:

REMOTE_USE_SSH=true
REMOTE_SSH_PORT=22
REMOTE_SSH_USERNAME=
REMOTE_DATABASE_HOST=

REMOTE_DATABASE_USERNAME=
REMOTE_DATABASE_NAME=
REMOTE_DATABASE_PASSWORD=
REMOTE_DATABASE_IGNORE_TABLES=''

REMOTE_REMOVE_FILE_AFTER_IMPORT=true
REMOTE_IMPORT_FILE=true

For only MySQL remote connections:

REMOTE_DATABASE_HOST=
REMOTE_DATABASE_USERNAME=
REMOTE_DATABASE_NAME=
REMOTE_DATABASE_PASSWORD=
REMOTE_DATABASE_IGNORE_TABLES=''

REMOTE_REMOVE_FILE_AFTER_IMPORT=true
REMOTE_IMPORT_FILE=true

Set a comma seperate list of tables NOT to export in REMOTE_DATABASE_IGNORE_TABLES

Usage

To export a remote database to OVERRIDE your local database by running:

php artisan db:production-sync