czproject/sql-schema

Library for describe of the database schema.

v3.1.0 2021-06-07 17:14 UTC

This package is auto-updated.

Last update: 2023-03-07 20:55:06 UTC


README

Tests Status

Library for describe of the database schema.

Support Me

Do you like SqlSchema? Are you looking forward to the new features?

PayPal or credit/debit card

Bitcoin bc1qrq9egf99a6z3576twggrp6uv5td5r3pq0j4awe

Thank you!

Installation

Download a latest package or use Composer:

composer require czproject/sql-schema

CzProject\SqlSchema requires PHP 5.6.0 or later.

Usage

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();

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/