schmunk42/database-command
Composer 安装命令:
composer require schmunk42/database-command
包简介
Yii command to create database migrations from existing schema
README 文档
README
Yii command to create database migrations from existing schema.
Migration classes are created in application runtime folder.
Requirements
- Yii 1.1.*
Features
- primary key generation
- foreign key generation (skipped for SQLite)
- complete data and schmema dump
Download
Get it from github and place it into your application.
Or install it via composer require schmunk42/database-command.
Configuration
config/console.php
'commandMap' => array(
'database' => array(
'class' => 'vendor.schmunk42.database-command.EDatabaseCommand',
),
)
Note: You may have to replace
vendor.schmunk42.database-command.EDatabaseCommandwith the acutal installation path.
Usage
Run the command...
./yiic database
... to show the help page
dump [<name>] [--prefix=<table_prefix,...>] [--dbConnection=<db>]
[--createSchema=<1|0>] [--insertData=<1|0>] [--foreignKeyChecks=<1|0>]
[--ignoreMigrationTable=<1|0>] [--truncateTable=<0|1>]
[--insertAutoIncrementValues=<1|0>] [--migrationPath=<application.runtime>]
| Param | Default | Info |
|---|---|---|
| name | dump | migration class name |
| --prefix | dump only tables with given prefix (specify multiple prefixes separated by commas) |
|
| --createSchema | 1 | whether to create tables |
| --insertData | 1 | whether to create insert statements |
| --foreignKeyChecks | 1 | set to 0 to disable foreign key checks |
| --truncateTable | 0 | whether to remove all records from the table first |
| --dbConnection | db | application component to use |
| --migrationPath | application.runtime | default dump folder |
| --ignoreMigrationTable | 1 | whether to ignore to migration table |
| --insertAutoIncrementValues | 1 | whether to include values from auto-increment column |
Example
To create a migration from an existing application database schema, define an alternative database component in your
application, e.g. db-production.
This example shows data dumping, removes all data (truncate tables) and omits foreign key checks:
./yiic database dump p3_replace_data \
--prefix=Auth,Rights,usr,p3 --createSchema=0 \
--foreignKeyChecks=0 --truncateTable=1
Separate schema and data:
./yiic database dump my_schema --insertData=0
./yiic database dump my_data --createSchema=0
Replace your whole data with data from dbProduction:
./yiic database dump replace_data \
--truncateTable=1 --foreignKeyChecks=0 \
--createSchema=0 --dbConnection=dbProduction
The following command dumps all tables starting with p3_media and omits
the schema create statements:
./yiic database dump p3media_no_schema_production \
--prefix=p3_media --createSchema=0 --dbConnection=dbProduction
Resources
- Availble via Phundament 3 Composer Package Repository
http://packages.phundament.com - Fork on github
- CHANGELOG
- View at Yii Extensions
schmunk42/database-command 适用场景与选型建议
schmunk42/database-command 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.88k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2013 年 04 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「dump」 「command」 「migration」 「yii」 「create」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 schmunk42/database-command 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 schmunk42/database-command 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 schmunk42/database-command 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package will add the `dd` and `dump` helpers to your Phalcon application.
Dibi is Database Abstraction Library for PHP
A Wrapper for exec and it's results
Simple Twig extension improving templates debugging
Symfony bundle to monitor and execute commands
nice output for debug functions for PHP 5.3
统计信息
- 总下载量: 5.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 19
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2013-04-04