https://github.com/samuelmanzanera/yaml2ddl
Generate a DDL schema from yaml description
https://github.com/samuelmanzanera/yaml2ddl
ddl nodejs schema sql yaml
Last synced: 5 months ago
JSON representation
Generate a DDL schema from yaml description
- Host: GitHub
- URL: https://github.com/samuelmanzanera/yaml2ddl
- Owner: samuelmanzanera
- License: mit
- Created: 2018-08-10T13:11:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-09T14:07:31.000Z (almost 7 years ago)
- Last Synced: 2025-04-20T21:18:49.076Z (6 months ago)
- Topics: ddl, nodejs, schema, sql, yaml
- Language: JavaScript
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yaml2ddl
[](https://badge.fury.io/js/yaml2ddl)
Generate a DDL schema from yaml description
#### Support
- For SQL database
- Auto increment handled for MySQL, SQL Server, SQLITE
- Soon support for MongoDB### Installation
```sh
npm install yaml2ddl
```#### Usage
```js
const yaml2dll = require('yaml2dll')// Generate from file
const schemaFileUri = './user.table.yaml'
yaml2dll.generateFromFile(schemaFileUri, { dialect: 'mysql' })
.then()
.catch()//Generate from source
const sqlGenerated = yaml2dll.generate(yamlSource, { dialect: 'mysql' })
```### Schema example
```yaml
table: user
constraints:
- columns:
- id
name: PK_User
type: primary
columns:
- name: id
type:
datatype: int
options:
notnull: true
autoincrement: true
- name: email
type:
datatype: varchar
length: 100
```### Licence
MIT