定制 nf/migration 二次开发

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

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

nf/migration

Composer 安装命令:

composer require nf/migration

包简介

Add migration to NF Theme

README 文档

README

It's an extension for our theme https://github.com/hieu-pv/nf-theme

NF Migration

Installation

Migration package can be used in plugin also, with a plugin that is created with NF Core module

To create an empty plugin that use NF Core module, move to wp-contents/plugins

By running following command and select correct option you can create an empty plugin

vcc create-project --name="your_plugin_name"

Copy file uninstall.php from plugin/uninstall.php. So when plugin is unistalled the tables will automatically deleted

To use nf-core module in your plugin make sure you have correct configuration in config/app.php with is_plugin=true and plugin_file={your_main_plugin_file_name}

Step 1: Install Through Composer

composer require nf/migration

Step 2: Add the Service Provider

Open config/app.php and register the required service provider.

  'providers'  => [
        // .... Others providers
        \NF\Database\Providers\DatabaseServiceProvider::class,
    ],

Step 3: Update autoload rule

Add the following code to autoload section of your composer.json

    "classmap": [
        "database"
    ]

Step 4: Publish needed files

By run publis command we will see a new folder called database in your theme root directory

php command migration:publish

Step 5: Play with command

Create migration file

php command make:migration {file_name} --create="{table_name}"

Or you can create another to update existing table

php command make:migration {file_name} --table="{existing_table_name}"

Example:

// create test table
php command make:migration create_test_table --create=test

// update test table
php command make:migration add_more_column_to_test_table --table=test

Step 6: Migrate your tables

php command migrate

Rollback all migration file

php command migrate:rollback

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固