定制 joeyrush/better-migrate-seed 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

joeyrush/better-migrate-seed

Composer 安装命令:

composer require joeyrush/better-migrate-seed

包简介

An alternative migrate:fresh --seed command which allows you to create a group of seeders from your existing data and/or playback a group of seeders

README 文档

README

A wrapper around the artisan migrate:fresh --seed command in Laravel with some added quality of life functionality to assist during development.

Overview

This package allows you to create a snapshot of your database by generating a series of seeders (1 per table, plus a base seeder which calls all of the seeders) which sit within a named sub-directory in your database/seeds directory. You can then use these grouped seeders to populate your database from scratch after a fresh migrate - all within the same command.

You're free to customize the generated seeders, but be aware that if you generate another snapshot with an identical name - the new ones will overwrite the old ones.

Available Commands

There are 4 commands available with this package:

A step in replacement for artisan migrate:fresh --seed with additional functionality to generate seeders and pick which seeders to use after re-migrating. You can pass the --refresh flag to use migrate:refresh instead of migrate:fresh behind the scenes:

artisan seed:migrate

The migrate command also comes with a bonus --include-empty-tables flag which will produce a seed class for every database table regardless of whether it has any rows or not.

To generate the seeders without having to re-migrate your DB, you can run the following command:

artisan seed:generate

To delete a set of seeders generated with any of the previous two commands (this will prompt before deletion):

artisan seed:delete

To rename a set of generated seeders (renames folder/filename/classname and references!)

artisan seed:rename

Notes

The name you supply to the seed generator will have spaces stripped out and be pascal-cased before being used as the sub-folder name and seeder class prefix. If you don't provide a name, it will generate one based on the current UNIX timestamp.

Requirements

  • Laravel 5.3.8+

Getting Started

You can install the package via composer:

composer require joeyrush/better-migrate-seed

Assuming you're on Laravel 5.5+ with auto-package discovery, you should be able to run the commands straight away. If you're rocking an earlier version, you'll have to add the service provider to the "providers" key in config/app.php

'providers' => [
    ...
    JoeyRush\BetterMigrateSeed\BetterMigrateSeedServiceProvider::class,
]

Tests

Coming soon

Credits

This package heavily relies on the use of iSeed by OrangeHill

joeyrush/better-migrate-seed 适用场景与选型建议

joeyrush/better-migrate-seed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.27k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2019 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 joeyrush/better-migrate-seed 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 11.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-22