Statistics
131
0
1
10d
Badges

Schema Generator

Build Status

Become a Patron!

Installation

Download a latest package or use Composer:

composer require inlm/schema-generator

Schema Generator requires PHP 5.6.0 or later.

Usage

$extractor = new Inlm\SchemaGenerator\Extractors\LeanMapperExtractor(__DIR__ . '/model/Entities/', new LeanMapper\DefaultMapper);
$adapter = new Inlm\SchemaGenerator\Adapters\NeonAdapter(__DIR__ . '/.schema.neon');
$dumper = new Inlm\SchemaGenerator\Dumpers\SqlDumper(__DIR__ . '/migrations/structures/');
$logger = new Inlm\SchemaGenerator\Loggers\MemoryLogger;

$generator = new Inlm\SchemaGenerator\SchemaGenerator($extractor, $adapter, $dumper, $logger, Inlm\SchemaGenerator\Database::MYSQL);
// $generator->setTestMode();

$generator->generate();
// or
$generator->generate('changes description');

Documentation

Supported databases:

  • MySQL

Extractors

Extracts new database schema from given source - entities, database or file.

Adapters

Persists database schema in file, memory,...

Dumpers

Dumps changes of database schema into migration file, database,...

Loggers


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

  • v0.6.2 Version 0.6.2

    • IIntegration - added method initFromDatabase() (little BC break)
  • v0.6.1 Version 0.6.1

    • Utils\Generator - relationships are created after primary indexes
    • Utils\Generator - throws exception only for incompatible primary keys
  • v0.6.0 Version 0.6.0

    • DibiMysqlExtractor renamed to DibiExtractor (BC break)
    • added DibiAdapter
    • LeanMapperExtractor autoloads entities
    • Diffs\CreatedTable & Diffs\UpdatedTable - added method getTableName() (BC break)
    • added SqlMemoryDumper
    • diffs are ordered by foreign keys
    • Utils\Generator massively improved (BC break)
    • LeanMapperExtractor - added annotation @schemaIgnore
    • SchemaGenerator & AbstractSqlDumper requires name of database (constant from Inlm\SchemaGenerator\Database) (BC break)
    • AbstractSqlDumper - added setHeader()
    • added IIntegration & LeanMapperIntegration
    • Integrations: added bridge for czproject/phpcli
    • improved support for Single Table Inheritance
    • improved tests
    • updated docs
    • many fixes & improvements
  • v0.5.2 Version 0.5.2

    • SchemaGenerator - added method removeOption()
    • improved handling of datatypes
    • updated README & docs
  • v0.5.1 Version 0.5.1

    • added parameter $description to $generator->generate()
  • v0.5.0 Version 0.5.0

    • added NeonExtractor
    • added MemoryAdapter
    • fixed Utils\Generator
    • DibiDumper - fixed $dibi->query()
    • LeanMapperExtractor - fixed DateTime recognition
    • Utils\Generator - improved column updating
    • uses czproject/logger
  • v0.4.0 Version 0.4.0

    • SqlDumper: throws exception if file already exists
    • SqlDumper: setDeepStructure replaced by setOutputStructure
  • v0.3.1 Version 0.3.1

    • DataTypeParser - added support for strings & enum
    • Readme: updated
  • v0.3.0 Version 0.3.0

    First public release.

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com