jamayka/db-patcher

数据库补丁工具

0.0.4 2014-10-01 05:24 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:47:26 UTC


README

一个小型的PHP CLI脚本,用于修补数据库。支持.sql和.php补丁。

安装

在您的composer json中将它作为依赖项包括。db-patcher.php将可在您的bin目录中找到(通常位于vendor/bin)

还需要在json或php格式的配置。它会尝试在您的项目目录等位置查找db-patcher.json或db-patcher.php。但如果您有特定的供应商目录或您在其他目录中有配置,您应该使用命令选项--config指定配置文件

PHP配置文件示例

<?php
return array(
    'db' => array(
        'dbname' => 'dbname',
        'user' => 'user',
        'password' => 'password',
        'host' => 'localhost',
        'port' => '5432',
        'charset' => 'UTF8'
    ),
    'directory' => '../scripts/update/'
);

JSON配置文件示例

{
    "db": {
        "dbname": "dbname",
        "user": "user",
        "password": "password",
        "host": "localhost",
        "port": "5432",
        "charset": "UTF8"
    },
    "directory": "../scripts/update/"
}

用法

Usage: vendor/bin/db-patcher.php [masks] [options]

Parameters:
    [masks] Filename masks of patches to apply whitespace delimited

Options:
    -l, --list Just output list of patches
    -n, --new Install new patches
    -c, --changed Install changed patches
    -e, --error Install error patches
    -a, --all Install all patches (installed, errors, changed, new)
    -i, --interactive Interactive mode
    -m, --mark-installed Do not actually apply patch just mark as installed
    -s, --stop-on-error Stop patches on error
    -cf, --config [filename] Config json filename
    -h, --help Output usage information