comunedifirenze/mysql-workbench-schema-exporter
Converts MySQL Workbench .mwb models into other schemas via formatter/exporter plugins, including Doctrine 1/2 (YAML/annotations), Propel (XML/YAML), Zend Framework, Sencha ExtJS models, and Node Sequelize. Includes a CLI; install via Composer.
Strengths:
doctrine/orm) or Propel ORM, enabling seamless migration from MySQL Workbench models (.mwb) to PHP-based schemas (YAML/Annotations).Gaps:
Illuminate\Database\Eloquent\Model conventions).Doable with Effort:
doctrine/orm (if already in stack). Generate YAML/Annotations and import via Doctrine’s tools (e.g., doctrine orm:convert-mapping).@ORM\Column to Eloquent attributes).Blockers:
Medium Risk:
laravel-doctrine/orm). Test for compatibility.php artisan schema:export).Mitigation:
--dev in composer.json to avoid runtime conflicts.php artisan mwb:export --format=doctrine2-annotation).deploy:prepare)?Compatibility:
doctrine/orm alongside Laravel. Generated annotations/YAML can be imported into Doctrine’s metadata..mwb models.Alternatives Considered:
doctrine/dbal can generate schemas, but lacks MySQL Workbench integration..mwb files would be more effort than leveraging this package.Assessment Phase:
.mwb models for Laravel compatibility (e.g., reserved keywords, unsupported data types).Toolchain Setup:
composer require --dev mysql-workbench-schema-exporter/mysql-workbench-schema-exporter
composer require --dev mysql-workbench-schema-exporter/doctrine2-exporter
export.json) for CLI automation (see README for examples).Integration Options:
vendor/bin/mysql-workbench-schema-export --export=doctrine2-annotation --config=export.json path/to/model.mwb app/Doctrine/Entities
app/Console/Commands/ExportMwbSchema.php) to wrap the CLI tool:
public function handle() {
$command = base_path('vendor/bin/mysql-workbench-schema-export');
$args = ['--export=doctrine2-annotation', '--config='.base_path('export.json'), $this->argument('mwb_file'), $this->argument('output_dir')];
shell_exec("{$command} " . implode(' ', $args));
}
Register in app/Console/Kernel.php and run via:
php artisan mwb:export path/to/model.mwb app/Entities
- name: Export MySQL Workbench Schema
run: vendor/bin/mysql-workbench-schema-export --export=doctrine2-annotation --config=export.json resources/model.mwb app/Entities
Post-Export Processing:
@ORM\Column with protected $attribute).mysql_* functions).laravel-doctrine/orm, verify the Doctrine 2 exporter’s output matches the bundle’s expected metadata format.skipPluralNameChecking, stripMultipleUnderscores) to match Laravel’s snake_case conventions.Initial Setup:
.mwb models to validate output (e.g., Sakila sample database).Incremental Adoption:
exportOnlyTableCategorized to isolate specific model categories.Feedback Loop:
ENUM to Laravel string with constraints).Production Rollout:
main.Pros:
export.json file manages all exports, easing updates.app/Entities/).Cons:
mysql-workbench-schema-exporter and its exporters as dev dependencies.composer.json.How can I help you explore Laravel packages today?