1.2.4 • Published 2 years ago

itatdbcodegen v1.2.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Introduction

This project will generate Microsoft SQL stored procedures using an Open API spec file

For now this project will only generate basic get, insert, update, & delete procs.

DELETE endpoints will generate _DELETE procs that update the Archived field to 1

POST endpoints will generate _SAVE procs that will insert or update a record depending on if the ID is passed in

Getting Started

Run: node index.js to generate db scripts using the default spec file (./spec.yml) or node index.js spec file name to use a different spec file

Options:

  • -s spec file name Allows you to specify the filename for your .yml file
  • -c Combines all procs into a single file for easy deployment

If no response schema is specified for a GET endpoint, the proc generated will use 'SELECT *' instead of listing the fields to return

DB Codegen will try to use the correct SQL data type based on a parameter's type/format fields. If a specific SQL type is needed other than NVARCHAR(MAX), INT, BIT, DATE, or DATETIME, simply put the SQL type in the type field (ex: type: NVARCHAR(128))

Note: for DATE/DATETIME fields use: 'type: string' & 'format: date' or 'format: date-time'

Custom spec file fields:

  • 'x-db-default: DB Name' Add to the 'info' section of the spec file to specify what database to use for all procs
  • 'x-db' Add to an endpoint to specify the database the proc is in
  • 'x-table-name: TableName' Specifies the DB table name. Codegen will use the response schema name, or the last part of the route as the default table name
  • 'x-proc-name: ProcName' Add this field to any endpoint to generate a proc script
  • 'x-primary-key: true' Add this to a schema field or parameter to specify what field to use as the ID
  • 'x-proc-ignore: true' Add to an endpoint to skip creating the procedure or add to a schema parameter to ignore that parameter on all procs that use the schema
1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.1.7

3 years ago

1.0.8

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago