dcblogdev/laravel-db-sync 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dcblogdev/laravel-db-sync

最新稳定版本:v1.1.7

Composer 安装命令:

composer require dcblogdev/laravel-db-sync

包简介

Sync database down.

README 文档

README

There is a Discord community. https://discord.gg/VYau8hgwrm For quick help, ask questions in the appropriate channel.

Laravel DB Sync

DB Dync

Introduction

Sync remote database to a local database

A word of warning you should only sync a remote database into a local database if you have permission to do so within your organisation's policies. I'm syncing during early phases of development where the data is largely test data and not actual customer data.

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_PORT=3306 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_PORT=3306 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

To generate a SQL with a custom file name REMOTE_DEFAULT_FILE_NAME

To specify a different local database connection:

LOCAL_TARGET_CONNECTION=different_mysql_connection 

Set the mysql command path:

LOCAL_MYSQL_PATH=/usr/bin/mysql 

For only mysqldump:

REMOTE_MYSQLDUMP_SKIP_TZ_UTC=true 

Usage

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

php artisan db:production-sync

Provide a filename for export on the fly by passing the option --filename, remember to provide .sql

php artisan db:production-sync --filename=other.sql

Run the command without attempting to export:

php artisan db:production-sync --test

Aliases

There are shortcuts that can be used:

-T = will use --test F = will use --filename

Alternative name

When connecting to a none production database, say a staging database you can choose to use this alternative name:

db:remote-sync may be used instead of db:production-sync

统计信息

  • 总下载量: 33.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 318
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 318
  • Watchers: 2
  • Forks: 33
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固