承接 io4n/yii2-dump 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

io4n/yii2-dump

Composer 安装命令:

composer require io4n/yii2-dump

包简介

Generate the schema from an existing database

README 文档

README

Generate migration file from an existing database

github: https://github.com/Hzhihua/yii2-dump
oschina: http://git.oschina.net/hzhihua/yii2-dump

Demo

yii2-dump

Test Environment

  • PHP >= 5.5.0
  • MySQL(5.6.36)

Installation

composer require --prefer-dist "hzhihua/yii2-dump:1.0.3"

Configuration

Add the following in console/config/main.php:

Simple Configuration

return [
    'controllerMap' => [
        'dump' => [
            'class' => 'hzhihua\dump\DumpController',
            'filePrefix' => '123456_654321',
            'tableOptions' => 'ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci', // if mysql >= 5.7, you can set “ENGINE=InnoDB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci”,
        ],
    ],
];

Detail Configuration  see

return [
    'controllerMap' => [
        'dump' => [
            'class' => 'hzhihua\\dump\\DumpController',
            'db' => 'db', // Connection
            'templateFile' => '@vendor/hzhihua/yii2-dump/templates/migration.php',
            'generatePath' => '@console/migrations',
            'table' => 'table1,table2', // select which table will be dump(default filter migration table)
            'filter' => 'table3,table4', // table3 and table4 will be filtered when generating migration file
            'limit' => '0,1000', // select * from tableName limit 0,1000
            'filePrefix' => '123456_654321',
            'tableOptions' => 'ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci', // if mysql >= 5.7, you can set “ENGINE=InnoDB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci”,
            // ... ...
        ],
    ],
];

Default Table Options

ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci

it was defined at "@vendor/hzhihua/yii2-dump/src/Migration.php" file see

Default Limit

0,1000

Default Filter Table

migration

Tips

You may neet to remove the migration file that its name is "*_init.php" before you run "./yii migrate" commond. because it will generate "{{%user}}" table file when you run "./yii dump" commond and the file name with "*_init.php" also create "{{%user}}" table. it will tip you "{{%user}}" has always exits.

Simple Usage

run dump command.

cd /path/to/your-project
./yii dump # default action: generate, it will gerate migration file

Commands

Check help

./yii help dump

print all over the table name without table prefix

./yii dump/list

generate all over the table migration file(default filter migration table)

./yii dump
or
./yii dump/generate

generate all over the table migration file but it only had some data between 0 and 10

./yii dump -limit=10

only generate table1,table2 migration file

./yii dump -table=table1,table2

only generate table1,table2 migration file and only table1 will be dumped table data

./yii dump -table=table1,table2 -data=table1

generate all over the migration table file without table1,table2

./yii dump -filter=table1,table2

print all over the code of migration table file(default filter migration table)

./yii dump/create

Display the 'createTable' code at the terminal.

./yii dump/create

Display the 'dropTable' code at the terminal.

./yii dump/drop

-type params

./yii dump -type=0/1/2/3
>>> -type=0 generate table migration file,
>>> -type=1 generate table data migration file,
>>> -type=2 generate add key migration file,
>>> -type=3 generate add foreign key migration file

Useful commands (for macOS user):

./yii dump | pbcopy
./yii dump/drop | pbcopy

Supports

  • Types
  • Size
  • Unsigned
  • NOT NULL
  • DEFAULT Value
  • COMMENT
  • Unique key
  • Foreign key
  • Primary key
  • ENUM type (for MySQL)
  • AUTO_INCREMENT

Not Supports

AUTO_INCREMENT

io4n/yii2-dump 适用场景与选型建议

io4n/yii2-dump 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.81k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 07 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 io4n/yii2-dump 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-07-11