czproject/sql-schema

数据库模式描述库。

v3.1.4 2023-07-27 10:25 UTC

This package is auto-updated.

Last update: 2024-08-27 12:40:10 UTC


README

Build Status Downloads this Month Latest Stable Version License

数据库模式描述库。

Donate

安装

下载最新包或使用Composer

composer require czproject/sql-schema

CzProject\SqlSchema 需要 PHP 5.6.0 或更高版本。

用法

use CzProject\SqlSchema\Index;
$schema = new CzProject\SqlSchema\Schema;

$table = $schema->addTable('book');
$table->addColumn('id', 'INT', NULL, array('UNSIGNED'));
$table->addColumn('name', 'VARCHAR', array(200));
$table->addColumn('author_id', 'INT', NULL, array('UNSIGNED'));
$table->addIndex(NULL, 'id', Index::TYPE_PRIMARY);
$table->addIndex('name_author_id', array('name', 'author_id'), Index::TYPE_UNIQUE);

$schema->getTables();

许可证: 新BSD许可证
作者: Jan Pecha, https://www.janpecha.cz/