Home Reference Source Repository

project-collection

A collection that holds all projects and allows you to manipulate & sync them with ease

build status Docs status

Installation

npm install --save schema-mapper-project-collection

Usage

var ProjectCollection = require('schema-mapper-project-collection');
var differ = require('schema-mapper-differ');

var projects = new ProjectCollection({}, differ);
var project = {
  name: 'demo', // Project name (similar to a database name)
  version: 1, // Project version (versions is where schema-mapper shines)
  schemas: {
    // The keys in this oject are the unique id's for the schema
    '0': {
      name: 'users', // Schema name (similar to a database table)
      primary: '0', // The schema id of the primary key
      columns: {
        // The keys in this object are the unique id's for the columns
        '0': {
          name: 'id', // Column name (similar to database column name)
          type: 'integer' // Column type (see spec which types are supported)
        },
        '1': {
          name: 'email',
          type: 'string'
        }
      }
    }
  }
};
projectCollection.putProject('0', project);
console.log(projectCollection.getStagingChanges());

// shows a project.create and project.tag change

API docs

Api Docs

Licence

MIT