Download the PHP package chippyash/db-plantuml without Composer
On this page you can find all versions of the php package chippyash/db-plantuml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package db-plantuml
PlantUML Database Support
chippyash/db-plantuml
What
- Provides Plantuml !include files that you can use to create logical and physical database diagrams
- Provides a (PHP) utility to turn the diagrams into DDL files to create your database.
PlantUml Support
- Tested with PlantUML V1.2021.12 - Graphviz version 2.43.0
2 definition files
- DatabaseLogical.iuml
- DatabasePhysical.iuml
Goal
To quickly create logical db designs that end users might understand and convert them to initial physical designs with additional functionality that can be turned into something developers will understand, i.e. a SQL Schema
Demo
- Open
examples\User-Logical.puml
and display the drawing - Open
examples\User-Physical.puml
and display the drawing
Look at both files. The only difference between them is
- a/ the included file defined at top of definition
- b/ physical drawing has additional features
- View
- Trigger & trigger()
- (Stored) Proc and uses()
The original logical definition was copy-pasta'd from the logical file to the physical file and renders automatically in physical form.
Take a look at the dist\*.iuml
files. It's the subtle differences between the
function declations that allows the transform to happen.
Installation
There is no real need to install this code base. You can access the
required files remotely using the !includeurl
directive.
You do however, need to install PlantUml!
Usage
- Create your logical model to represent customer/user view
- Copy logical model file to physical model file and change the !include statement. Amend as necessary.
- (Optional) Generate the SQL DDL file to create your database
Logical Models
!include ../dist/DatabaseLogical.iuml
or
!includeurl https://raw.githubusercontent.com/chippyash/db-plantuml/master/dist/DatabaseLogical.iuml
Logical model will display the following differently to their representation in a Physical model
Components
Data types
NB string and int lengths do not display in logical models, but specify them if you know them as they will be displayed in physical models.
You can display other data types directly in your entity classes e.g.
Type modifiers
Indexes and keys
Relationships
There is an internal relationship _join
You can use this to fine tune relationships as required. fNum & tNum accept an integer or 'n'.
Physicals Models
!include ../dist/DatabasePhysical.iuml
or
!includeurl https://raw.githubusercontent.com/chippyash/db-plantuml/master/dist/DatabasePhysical.iuml
Use the same statements as per Logical models. In addition there are:
Components
Indexes and keys
Foreign keys are automatically generated where appropriate between Tables in your model. You may need to explicitly declare them for Tables that are off model.
Relationships
These uses
relationships is purely informational.
User defined data types
Whilst many SQL RDMS natively support user defined data types, many do not, including the ever popular MySql/MariaDb. You can achieve this functionality in PlantUml yourself.
and then use them in your Table definitions:
See (PlantUml Preprocessing)[https://plantuml.com/preprocessing] for more ideas.
Diagram to SQL conversion
A PHP utility CLI program that will convert your physical diagram to SQL DDL.
MySql is supported at this release.
- Installation - "See Installation - production use" below
Basic usage
bin/pumldbconv g ./examples/User-Physical.puml ./out.sql
Which will convert the example physical diagram into SQL looking thus:
The program assumes that your plantuml.jar is located at:
- /usr/share/plantuml/plantuml.jar for Linux
- "C:/Program Files/Java/jars/plantuml.jar" for Windows
If this is not the case, you can specify the folder location with the -p
flag e.g.:
bin/pumldbconv g -p /usr/local/javajars ./examples/User-Physical.puml ./out.sql
Installation - production use
You will need PHP8.0+ with the xsl and xml extensions installed to use this program.
- Clone/Fork this repo or grab an archive and unzip it
- Move the bin/pumldbconv file into a directory in your path, perhaps
/usr/local/bin
- Check that you can execute it with
pumldbconv -V
- Remove the source files if no longer required
Installation - development
Caveat: These instructions assume a Linux OS. (If you are a Windows/Mac user, please consider adding installation and usage instructions to this repo by way of a pull request.)
- Clone/Fork this repo or grab an archive and unzip it
- Install Composer
- Install the PHP XSL extension e.g. For Debian based Linux
PHP normally has the XML extension built-in, but you may need to install it manually.
- run
composer install
Building
Will build a new PHAR executable in the bin directory. You will need Box installed
and your php.ini
settings modified to build phar files (off by default).
Changing the library
- fork it
- write the test
- amend it
- do a pull request
Found a bug you can't figure out?
- fork it
- write the test
- do a pull request
NB. Make sure you rebase to HEAD before your pull request
Or log an issue ticket in Github.
Where?
The library is hosted at Github. It is available at Packagist.org
License
This software is licensed under the BSD-3 Clause license.
History
V0.0.0 Initial alpha release
V0.0.1 Alpha release with DDL generator
V1.0.0 Upgrade to use PHP 8 and latest version of PlantUML
V1.1.0 Add UNSIGNED attribute support