Feathers Knex modeler
This package allows you to easily extend a table while you are developing it without requiring you to drop tables.
Usage
Within Feathers
The below contain the contents of two files the model file and the service file.
// test.model.js - A KnexJS//// See http://knexjs.org/// for more of what you can do here.module { const tableName = 'users' const db = app const Modeler = const modeler = name: tableName depends: 'organizations' columns: name: 'id' type: 'increments' name:'organization_id'type:'integer'options: type: 'references' argument: 'organizations.id' name: 'value' type: 'integer' options: type: 'notNullable' name: 'name' type: 'text' options: type: 'notNullable' name: 'schema_type' type: 'text' options: type: 'notNullable' name: 'status' type: 'text' options: type: 'notNullable' name: 'shared' type: 'bool' options: type: 'notNullable' db modeler return db} // test.service.js - A KnexJS//// Initializes the `fields` service on path `/test`const createService = const createModel = const hooks = module { const Model = const paginate = app const options = name: 'fields' Model paginate // Initialize our service with any options it requires app // Get our initialized service so that we can register hooks and filters const service = app service}
Standalone
The below contain the contents of two files the model file and the service file.
'use strict'const knex = const Modeler = const db = const testModel = name: 'test' depends: columns: name: 'id' type: 'increments' name: 'name' type: 'text' options: type: 'notNullable' name: 'schema_type' type: 'text' options: type: 'notNullable' name: 'status' type: 'text' options: type: 'notNullable' name: 'shared' type: 'bool' options: type: 'notNullable' db testModel