2.0.0 • Published 10 months ago

json-schema-table v2.0.0

Weekly downloads
15
License
MIT
Repository
github
Last release
10 months ago

json-schema-table NPM version Dependency Status CircleCI Coverage Status

Creates and maintains a SQL table structure equivalent to a json schema definition. For MSSQL and Postgres

First you create all your tables and then syncronizes then with each other to create the references. You can sync whenever you modify your json schema

Install

$ npm install --save json-schema-table

Usage

var jsonSchemaTable = require('json-schema-table');
var pg = require('pg-cr-layer');
var studentSchema = require('./student.json');
var classSchema = require('./class.json');

// initialize and connect to a database

var studentTable = jsonSchemaTable('person', studentSchema, {db: pg});
var classTable = jsonSchemaTable('student', classSchema, {db: pg});

// First create then sync to build the references
studentTable.create().then(function() {
	return classTable.create();
}).then(function() {
	return studentTable.sync();
}).then(function() {
	return classTable.sync();
}).catch(function(error) {
	console.log(error);
});

For the db connection you can use mssql-cr-layer or pg-cr-layer

To more details take a look at the tests

License

MIT © Andre Gloria

2.0.0

10 months ago

1.0.25

1 year ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago