定制 philwc/version-db 二次开发

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

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

philwc/version-db

Composer 安装命令:

composer require philwc/version-db

包简介

Easy database versioning :)

README 文档

README

#VersionDB

##To Install:

  • Add to your composer.json:
"require": {
     "philwc/version-db": "dev-master"
}
  • Run
composer.phar update
  • Add a settings.yml file:
parameters:
    database:
      user: <DBUSER>
      password: <DBPASS>
      host: <DBHOST>
      name: <DBNAME>
      changelogtable: changelog
    file:
      sqlDir: <LOCATION OF SQL FILES>
  • Create a new file in the project root called console, with the following contents:
#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/philwc/version-db/console';

##To Use:

  • Add A Revision:
php console add

You will be prompted to fill in the required fields

  • Upgrade Database:
php console upgrade

This will read the SQL Dir (From settings.yml) and apply the update SQL scripts in date order

  • Downgrade Database:
php console downgrade

This will read the changelog table and allow you to select where to downgrade to. It will then apply the downgrade SQL scripts in date descending order until it hits the record specified.

  • Web Front End:

There is an example file (index.php) for how to use the front end. The fields may be rendered by the class, using

$change = new \philwc\Web\AddChange();
$change->getHtml($action);

or by rendering manually, i.e.

$change = new \philwc\Web\AddChange();
$html   = '<form id="vdbAdd" method="POST">';
foreach ($change->getFields() as $field) {
    //Split the fields names into a nice title format
    $a          = preg_split('/(?<=[a-z])(?=[A-Z])/x', $field);
    $fieldTitle = ucwords(implode(' ', $a));

    $html .= '<label class="input-group" for="' . $field . '">' . $fieldTitle . ': <input class="visibleInput" type="text" name="' . $field . '" id="' . $field . '"/></label>';
}
$html .= '<input name="submit" type="submit"></form>';

echo $html;

Bitdeli Badge

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-10-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固