定制 mikejestes/scheezy 二次开发

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

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

mikejestes/scheezy

最新稳定版本:0.4.0

Composer 安装命令:

composer require mikejestes/scheezy

包简介

Translate yaml schema definitions into real actual databases

README 文档

README

A PHP 5.3+ library to translate yaml schema definitions into real, actual databases. You could view this as an intentional anti-pattern to database migration techniques. For when you don't want to migrate up and down, just dictate the database schema.

Build Status

Installation

Add to your composer.json file:

    {
        "require": {
            "mikejestes/scheezy": "*"
        },

        ...
    }

Then download and run composer:

curl -s https://getcomposer.org/installer | php
php composer.phar install

Schema Definition Syntax

table: store
columns:
    id:
    name:
        type: string
        length: 80
    email:
        index: unique
    active:
        type: boolean
        allow_null: true
    user_count:
        type: integer
        index: true
    website:
    created:
        type: datetime
    updated:
        type: timestamp
    calendar:
        type: date
    paragraph:
        type: text
    price:
        type: decimal
    latitude:
        type: decimal
        precision: 9
        scale: 6
    status:
        type: enum
        values:
            - approved
            - disabled
            - draft

A column defaults to string type, unless the name is id which is given an integer type, a primary key, and auto_increment.

Database engines

Currently supports mysql through PDO classes.

API

Load a directory of .yaml files

$pdoHandle = new PDO("mysql:host=localhost;dbname=scheezy_test", 'root', '');

$schema = new \Scheezy\Schema($pdoHandle);
$schema->loadDirectory(dirname(__FILE__) . '/schemas/');
$schema->synchronize();

Load a single .yaml file

$schema = new \Scheezy\Schema($pdoHandle);
$schema->loadFile('/path/to/ponys.yaml');
$schema->synchronize();

Alternatives

For actual migration style (up, down, rollback) try one of these:

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-30