php-extended / php-db-schema-mysql
一个用于抽象MySQL数据库模式规则的库
9.5.6
2024-07-31 13:55 UTC
Requires
- php: >=8.0
- php-extended/php-charset-object: ^7
- php-extended/php-db-schema-core: ^9.5
Requires (Dev)
- dev-master
- 9.5.6
- 9.5.5
- 9.5.4
- 9.5.3
- 9.5.2
- 9.5.1
- 9.5.0
- 9.4.7
- 9.4.6
- 9.4.5
- 9.4.4
- 9.4.3
- 9.4.2
- 9.4.1
- 9.4.0
- 9.3.1
- 9.3.0
- 9.2.4
- 9.2.3
- 9.2.2
- 9.2.1
- 9.2.0
- 9.1.30
- 9.1.29
- 9.1.28
- 9.1.27
- 9.1.26
- 9.1.25
- 9.1.24
- 9.1.23
- 9.1.22
- 9.1.21
- 9.1.20
- 9.1.19
- 9.1.18
- 9.1.17
- 9.1.16
- 9.1.15
- 9.1.14
- 9.1.13
- 9.1.12
- 9.1.11
- 9.1.10
- 9.1.9
- 9.1.8
- 9.1.7
- 9.1.6
- 9.1.5
- 9.1.4
- 9.1.3
- 9.1.2
- 9.1.1
- 9.1.0
- 9.0.2
- 9.0.1
- 9.0.0
- 8.0.0
- 7.0.7
- 7.0.6
- 7.0.5
- 7.0.4
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 6.1.2
- 6.1.1
- 6.1.0
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0.0
- 5.0.0
- 3.0.0
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
This package is auto-updated.
Last update: 2024-08-31 12:05:48 UTC
README
一个用于抽象MySQL数据库模式规则的库
安装
此库的安装通过composer进行,所有类的自动加载都通过它们的自动加载器完成。
- 从他们的网站下载
composer.phar
。 - 然后运行以下命令将此库作为依赖项安装
php composer.phar php-extended/php-db-schema-mysql ^9
基本用法
此库可以生成 CREATE DATABASE
语句。
use PhpExtended\DbSchema\MysqlTableFactory;
use PhpExtended\DbSchema\MysqlDialect;
use PhpExtended\DbSchema\MysqlTypeNumber;
use PhpExtended\DbSchema\MysqlTypeString;
$factory = new MysqlTableFactory();
$dialect = new MysqlDialect();
$factory->setName('<tableName>');
// <tableColumnId> INT(11) NOT NULL AUTO_INCREMENT COMMENT 'The primary key'
$factory->addColumn('<tableColumnId>', MysqlTypeNumber::INT(), 11, null, null, false, true, 'The primary key');
// <nameColumn> VARCHAR(255) NOT NULL COMMENT 'The name of the <xxx>'
$factory->addColumn('<nameColumn>', MysqlTypeString::VARCHAR(), 255, null, null, false, false, 'The name of the <xxx>');
$factory->addsToPrimaryKey('<tableColumnId>');
$sql = $dialect->showCreateTable($factory->getTable()); // CREATE TABLE ...
许可证
MIT (参见 许可证文件).