1.0.5 • Published 7 years ago

yaml2ddl v1.0.5

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

yaml2ddl

npm version

Generate a DDL schema from yaml description

Support

  • For SQL database
    • Auto increment handled for MySQL, SQL Server, SQLITE
  • Soon support for MongoDB

Installation

npm install yaml2ddl

Usage

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

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

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago