php-extended / php-db-schema-mysql
A library to abstract the mysql database schema rules
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-10-01 00:14:21 UTC
README
A library to abstract the mysql database schema rules
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.phar
from their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-db-schema-mysql ^9
Basic Usage
This library can generate CREATE DATABASE
statements.
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 ...
License
MIT (See license file).