nobodyiscertain/laravel-db-commands 问题修复 & 功能扩展

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

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

nobodyiscertain/laravel-db-commands

Composer 安装命令:

composer require nobodyiscertain/laravel-db-commands

包简介

A set of Artisan commands to help with database tasks.

README 文档

README

Here are few Artisan commands to help with common database tasks. This package currently handles:

Note: Currently, this package only supports MySQL. Should you have a need for a different database driver, please open an issue or feel free to fork and pull request away.

Installation

Install with Composer:

composer require nobodyiscertain/laravel-db-commands

Add service provider to config/app.php:

Nobodyiscertain\DbCommands\DbCommandsServiceProvider::class

On the command line, run:

php artisan vendor:publish

This will publish the config file laravel-db-commands.php to your config directory. You will need to configure that to match your setup and you should be good to go! Details on the configuration for each of the commands can be found below.

Pulling the Database

This command makes it a snap to pull a database dump from a specific environment. After you have it configured, a simple php artisan db:pull production will pull the production database and import it locally.

How to Run

php artisan db:pull <db_connection_name>

db_connection_name: Pass in the name of the connection used in your config/database.php that you'd like to pull.

Configuration

dbpull_auto_import: If you would like the database to be auto imported locally after it's pulled, set this to true, otherwise, false.

dbpull_local_db_conn: Set this to the name of your local db connection you'd like the dump imported to.

dbpull_dump_destination: Set this to a local path you'd like the dump to be stored. I generally use /tmp so it'll get wiped.

Preparing the Test Database

This command saves the hassle of typing the lengthy artisan command to refresh the testing database and, optionally, run the seeds. Inspried by a similar command in Rails.

How to Run

php artisan db:test-prepare

Configuration

testing_db_connection: Set this to the name of the testing database connection configured in config/database.php.

testing_run_seeds: If you'd like to run the seeds after the database is refreshed, set this to true, otherwise, false.

Backing up the Database

This command will pull a database dump and upload it to a configured filesystem location. It's great for making one off backups or scheduling with Artisan to make automated backups a breeze.

How to Run

php artisan db:backup

Configuration

backup_db_conn: This is the name of database connection in config/database.php you'd like to backup. Keep in mind the context of where this command will run. If it's going to be run on the a prodcution server, then most likely it'll be your default mysql connection.

backup_dump_destination: A local filepath to store the database dump. If on a UNIX-based system, /tmp works great.

backup_disk: This is the disk name from config/filesystems.php that you'd like to permanently store the database dump.

If you'd like to setup automated backups, drop in something like this into app/Console/Kernal.php.

$schedule->command('db:backup')->twiceDaily();

nobodyiscertain/laravel-db-commands 适用场景与选型建议

nobodyiscertain/laravel-db-commands 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.24k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 12 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「database」 「laravel」 「artisan」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nobodyiscertain/laravel-db-commands 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nobodyiscertain/laravel-db-commands 我们能提供哪些服务?
定制开发 / 二次开发

基于 nobodyiscertain/laravel-db-commands 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-02