v1.0.0 2024-02-06 00:28 UTC

This package is auto-updated.

Last update: 2024-09-06 01:43:12 UTC


README

描述

库包含框架模块,用于管理应用程序迁移。

要求

  • 脚本语言:PHP:版本 7 || 8

框架模块安装要求

  1. 模块仓库:liberty_code_module/validation:版本 1.0

    • 模块验证(或等效)。
    • 模块规则(或等效)。
  2. 模块仓库:liberty_code_module/datetime:版本 1.0

    • 模块 datetime(或等效)。

安装

有多种可能的安装方式

Composer

  1. 要求

    需要安装 composer。更多信息请参阅:https://getcomposer.org

  2. 命令:在项目根路径下移动

     cd "<project_root_path>"
    
  3. 命令:安装

     php composer.phar require liberty_code_module/migration ["<version>"]
    
  4. 注意

    • 包含供应商

      如果项目使用 composer,则必须包含 vendor

        require_once('<project_root_path>/vendor/autoload.php');
      
    • 配置

      安装命令允许在 composer 文件 "

        {
            "require": {
                "liberty_code_module/migration": "<version>"
            }
        }
      

包含

  1. 下载

    • 下载以下仓库。
    • 将其放置在仓库根路径上。
  2. 包含源代码

     require_once('<repository_root_path>/include/Include.php');
    

应用程序安装

配置

  1. 配置:应用程序模块: "

    在列表部分添加,所需模块

    YML 配置格式示例,来自 composer 安装

     list: [
         {
             path: "/vendor/liberty_code_module/migration/src/migration",
             config_parser: {
                 type: "string_table_php",
                 source_format_get_regexp: "#^\\<\\?php\\s*(.*)(\\s\\?\\>)?\\s*$#ms",
                 source_format_set_pattern: "<?php \\n%1$s",
                 cache_parser_require: true,
                 cache_file_parser_require: true
             }
         }
     ]
    
  2. 配置:DI: "

    • 获取以下类所需的最小配置

      • liberty_code\sql\persistence\table\model\TablePersistor

配置

应用程序参数配置

  • 在您的模块中使用以下文件来配置特定元素

      <module_root_path>/config/ParamApp.php
    
  • 可配置元素

    • 配置以填充迁移集合

用法

以下示例假设命令行应用程序相对路径为 "bin/app"。

迁移

功能允许管理应用程序迁移。

示例

cd "<project_root_path>"
...
// Show list of migrations
php bin/app migrate:show
...
// Execute migrations
migrate:execute
...
// Rollback migrations
migrate:rollback