Automatically use a default column for table references in dirac schemas.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
Gruntfile.js
README.md
index.js
package.json

README.md

Dirac Automatic Column Reference

Automatically use a column for table references in schemas.

/**
 * groups schema
 */

// Dirac table schema
{
  name: 'groups'
, schema: {
    id:    { type: 'serial', primaryKey: true }
  , name:  { type: 'text' }
    // No need to specify column: 'id' in the references
  , uid:   { type: 'integer', references: { table: 'users' } }
  }
}
/**
 * Main DB module
 */

var dirac = require('dirac');
var tableRef = require('dirac-table-ref');

dirac.use(
  // Override default column used `id`
  tableRef({ column: 'uuid'  })
);