Git Product home page Git Product logo

Build Status Latest Stable Version Total Downloads License

README

What is MySQL Workbench Schema Exporter?

MySQL Workbench Schema Exporter is a library to transform the MySQL Workbench model (*.mwb) to useful another schemas.

It is inspired by mysql-workbench-doctrine-plugin.

Currently, MySQL Workbench Schema Exporter can export the model to various schemas using a formatter plugin:

The actual conversion to another schema is done using an exporter. These plugins are available in subprojects:

Prerequisites

  • PHP 7.2+
  • Composer to install the dependencies

Installation

  1. In your project directory issue:
composer require --dev mysql-workbench-schema-exporter/mysql-workbench-schema-exporter
  1. You then can invoke the CLI script using vendor/bin/mysql-workbench-schema-export.

  2. You can directly require an exporter for your project:

composer require --dev mysql-workbench-schema-exporter/doctrine2-exporter

Command Line Interface (CLI)

The mysql-workbench-schema-export command helps export a workbench schema model directly from command line. It has feature to customize export configuration before exporting. By default, it will use config file export.json located in the current directory to supply the parameter if it find it.

Command usage:

vendor/bin/mysql-workbench-schema-export [options] FILE [DEST]

Where:

  • FILE

    The MySQL Workbench model file to export.

  • DEST

    The destination directory (optional), if not specified current directory assumed.

Options:

  • --export=type

Choose the result of the export, supported type can be obtained using --list-exporter. If this option is omitted and no config file found, the CLI will prompt to choose which exporter to use.

  • --config=file

Read export parameters from file (in JSON format).

  • --save-config

Save export parameters to file export.json, later can be used as value for --config=file.

  • --list-exporter

Show all available exporter.

  • --no-auto-config

Disable automatic config file lookup.

  • --zip

Compress the result.

  • --help

Show the usage (or suppress any parameters).

Sample usage:

vendor/bin/mysql-workbench-schema-export --export=doctrine1-yaml example/data/test.mwb ./generated
vendor/bin/mysql-workbench-schema-export --zip example/data/test.mwb

Configuring MySQL Workbench Schema Exporter

MySQL Workbench Schema Exporter can be configured at runtime using methods:

  • Configuration files.
  • Model comment, either applied to table, column, or foreign key object.

Refers to exporter project to show detailed information.

Common Model Comment Behavior

  • {MwbExporter:external}true{/MwbExporter:external} (applied to Table, View)

    Mark table/view as external to skip table/view code generation. For Doctrine use {d:external}true{/d:external} instead.

  • {MwbExporter:category}mycategory{/MwbExporter:category} (applied to Table)

    Table category used to groups the table for sorting. This way, generated table output can be sorted as you need such as in Propel YAML schema (obviously useful for exporter which results in single file output).

Using MySQL Workbench Schema Exporter as Library

If you want to use MySQL Workbench Schema Exporter as a library for other project. See the included usage in the example folder.

Test Database

Links

MySQL Workbench Schema Exporter's Projects

exporter icon exporter

Export MySQL Workbench Schema model into various models such as Doctrine, Propel, Sequelize, and others.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.