https://github.com/niklauslee/staruml-ddl
StarUML extension for DDL Generation
https://github.com/niklauslee/staruml-ddl
Last synced: 6 months ago
JSON representation
StarUML extension for DDL Generation
- Host: GitHub
- URL: https://github.com/niklauslee/staruml-ddl
- Owner: niklauslee
- License: mit
- Created: 2016-05-02T08:06:00.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-01-24T01:41:23.000Z (over 4 years ago)
- Last Synced: 2023-08-10T10:03:24.793Z (almost 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 34
- Watchers: 6
- Forks: 30
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DDL Extension for StarUML
=========================This extension for StarUML (http://staruml.io) support to generate DDL (Data Definition Language) from ERD. Install this extension from Extension Manager of StarUML.
How to use
----------1. Click the menu (`Tools > DDL > Generate DDL...`)
2. Select a data model that will be generated to DDL.
3. Save the generated DDL to a file.Generation rules
----------------Belows are the rules to convert from ERD elements to DDL.
* All entities and columns are converted to create table statements as follow:
```sql
CREATE TABLE entity1 (
col1 INTEGER,
col2 VARCHAR(20),
...
);
```* Primary keys are converted as follow:
```sql
CREATE TABLE entity1 (
pk1 INTEGER,
pk2 VARCHAR(10),
...
PRIMARY KEY (pk1, pk2, ...)
);
```* Not-nullable columns are converted as follow:
```sql
CREATE TABLE entity1 (
col1 VARCHAR(20) NOT NULL,
...
);
```* Unique columns are converted as follow:
```sql
CREATE TABLE entity1 (
...
UNIQUE (col1, col2, ...)
);
```* Foreign keys are converted as follow:
```sql
CREATE TABLE entity1 (
fk1 INTEGER,
...
);
...ALTER TABLE entity1 ADD FOREIGN KEY (fk1) REFERENCES entity2(col1);
```* If `Quote Identifiers` option is selected, all identifiers will be surrounded by a backquote character.
```sql
CREATE TABLE `entity1` (
`col1` INTEGER,
`col2` VARCHAR(20),
...
);
```* If `Drop Tables` option is selected, drop table statements will be included.
(__MySQL__ selected in `DBMS` option)
```sql
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS entity1;
...
SET FOREIGN_KEY_CHECKS = 1;CREATE TABLE entity1 (...);
...
```(__Oracle__ selected in `DBMS` option)
```sql
DROP TABLE entity1 CASCADE CONSTRAINTS;`
...CREATE TABLE entity1 (...);
...
```Contributions
-------------Any contributions are welcome. If you find a bug or have a suggestion, please post as an issue.