1 Star 0 Fork 0

sizeofio / tp5-migrate

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

基于 phinx 开发的针对 tp 5.0.* 的数据库迁移工具。

配置

<?php

return [
    'environments'=>[
        'default_migration_table'=>'phinxlog',
        'default_database'=>'default',
        'default'=>[
            'adapter'=>'mysql',
            'host'=>'127.0.0.1',
            'name'=>'',
            'user'=>'',
            'pass'=>'',
            'table_prefix'=>'',
            'port'=>3306,
            'charset'=>'utf8',
            'collation'=>'utf8mb4_unicode_ci'
        ]
    ]
];

migrate:create

用来创建迁移脚本文件。只需要一个参数:脚本名,迁移脚本命名应该保持驼峰命名法

$ php think migrate:create ScriptName

migrate:run

执行迁移脚本。如果不带参数则默认执行所有迁移脚本。

参数 描述
--e 指定环境
--t 指定执行某个迁移脚本

migrate:rollback

回滚之前的迁移脚本,与 Run 命令相反。不带任何参数则是回滚上一个迁移脚本。

参数 描述
--e 指定环境
--t 回滚指定版本的脚本(设置为0则回滚所有脚本)
--d 回滚指定日期的脚本

migrate:breakpoint

设置断点,可以让你对回滚进行限制。如果不带任何参数执行则是将断点设置在最新的迁移脚本上。

参数 描述
--e 指定环境
--t 指定需要打断点的迁移版本
--r 移除所有断点

migrate:status

查看断点信息


seed:create

创建一个新的 seed 类。

$ php think seed:create UserSeeder

seed:run

执行 seed 注入数据。默认执行所有的 seed,如果需要指定执行某个 seed,则可以使用 --s 参数。

不像 migrate,Phinx 并不会记录 seed 是否执行过,所以 seed 可以被重复执行。

(The MIT license) Copyright (c) 2020 sizeofio Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于 phinx 开发的针对 thinkphp5.0.* 的数据库迁移组件。 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/pchangl/tp5-migrate.git
git@gitee.com:pchangl/tp5-migrate.git
pchangl
tp5-migrate
tp5-migrate
master

搜索帮助