inlm / schema-generator
Schema generator for PHP apps.
Fund package maintenance!
Other
Installs: 1 192
Dependents: 2
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=5.6.0
- czproject/dependency-php: ^2.0
- czproject/logger: ^0.12.0
- czproject/sql-generator: ^2.0
- czproject/sql-schema: ^3.1
- nette/neon: ^2.4 || ^3.0
- nette/utils: ^2.4 || ^3.0 || ^4.0
Requires (Dev)
- inteve/types: ^0.5 || ^1.0 || ^2.0
- nette/tester: ^2.0
- dev-master
- v1.1.0
- v1.0.0
- v0.10.11
- v0.10.10
- v0.10.9
- v0.10.8
- v0.10.7
- v0.10.6
- v0.10.5
- v0.10.4
- v0.10.3
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.14
- v0.9.13
- v0.9.12
- v0.9.11
- v0.9.10
- v0.9.9
- v0.9.8
- v0.9.7
- v0.9.6
- v0.9.5
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.0
- v0.7.3
- v0.7.2
- v0.7.1
- v0.7.0
- v0.6.4
- v0.6.3
- v0.6.2
- v0.6.1
- v0.6.0
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.0
- v0.3.1
- v0.3.0
- dev-version-0.9
This package is auto-updated.
Last update: 2024-11-14 13:40:57 UTC
README
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\LeanMapperBridge\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
How it works?
- adapter loads old schema if exists. Schema can be stored in file, memory,...
- extractor extracts new schema from entities, file, database,...
- generator generates diff between old and new schema
- dumper dumps differences to SQL file, database,...
- adapter saves new schema (only if is test mode disabled)
Extractors
Extracts new database schema from given source - entities, database or file.
- LeanMapperExtractor (package
inlm/schema-generator-leanmapper
) - DibiExtractor (package
inlm/schema-generator-dibi
) - NeonExtractor
Adapters
Persists database schema in file, memory,...
- NeonAdapter
- MemoryAdapter
- DibiAdapter (package
inlm/schema-generator-dibi
)
Dumpers
Dumps changes of database schema into migration file, database,...
- SqlDumper
- SqlMemoryDumper
- DibiDumper (package
inlm/schema-generator-dibi
) - NullDumper
Loggers
You can use loggers from czproject/logger
.
CzProject\Logger\CliLogger
CzProject\Logger\MemoryLogger
CzProject\Logger\OutputLogger
- or any else
More
Tip
If you need generate ... AFTER column
in ALTER TABLE
statements, call:
$schemaGenerator->enablePositionChanges();
License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/