php-bread-and-butter/codeignitermigration 问题修复 & 功能扩展

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

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

php-bread-and-butter/codeignitermigration

Composer 安装命令:

composer require php-bread-and-butter/codeignitermigration

包简介

Codeigniter Migration

README 文档

README

Customized CodeIgniter bare migration package to support command line migrate and supress to run the up and down method in the migration file. Added support for .env file config

Requirements

  • To load .env file "vlucas/phpdotenv" package is required

Installation

$ composer require php-bread-and-butter/codeignitermigration

Usage

$ php vendor/php-bread-and-butter/codeignitermigration/ci migration:bare add_new_post_table

OR, you can also CD to the package directory.

$ cd vendor/php-bread-and-butter/codeignitermigration
$ php ci migration:bare add_new_post_table

The above example will create a new migration file application/migrations/{YmdHis}_add_new_post_table.php where {YmdHis} would be the current timestamp. You can also use CamelCase style for migration name such as AddNewPostTable, but the tool will convert it to snake_case form like add_new_post_table. The default generated content would be like this:

<?php defined('BASEPATH') or exit('No direct script access allowed');

class Migration_Add_New_Post_Table extends CI_Migration
{
    public function up() {
        // this up() migration is auto-generated, please modify it to your needs
        // Drop table 'table_name' if it exists
        $this->dbforge->drop_table('table_name', true);

        // Table structure for table 'table_name'
        $this->dbforge->add_field(array(
            'id' => array(
                'type' => 'MEDIUMINT',
                'constraint' => '8',
                'unsigned' => true,
                'auto_increment' => true
            ),
            'created_at' => array(
                'type' => 'DATETIME',
                'null' => false,
            )
        ));
        $this->dbforge->add_key('id', true);
        $this->dbforge->create_table('table_name');
    }

    public function down()
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->dbforge->drop_table('table_name', true);
    }
}

You can modify the file according to your need.

Alternate usage of the command

$ php ci migration:bare add_new_column_to_post_table
$ php ci migration:bare modify_post_table
$ php ci migration:bare update_post_table
$ php ci migration:bare rename_post_table
$ php ci migration:bare remove_post_table

Now execute migrate

$ php vendor/php-bread-and-butter/codeignitermigration/migrate

The migration can be rolled back using

$ php vendor/php-bread-and-butter/codeignitermigration/suppress ${VERSION}

Replace ${VERSION} with {YmdHis}, where {YmdHis} would be the timestamp of previous migration file, like 20211002092605

php-bread-and-butter/codeignitermigration 适用场景与选型建议

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

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

围绕 php-bread-and-butter/codeignitermigration 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-20