periodicjs.core.data
Version:
Core data is the ORM wrapping component of periodicjs.core.controller that provides database adapters for commonly used databases (ie. mongo, sql, postgres). Adapters provide a standard set of methods and options regardless of the type of database and so
30 lines (27 loc) • 458 B
JavaScript
;
const Sequelize = require('sequelize');
/**
* Default changeset schema for sql databases
*/
const EXAMPLE = {
createdat: {
type: Sequelize.DATE
},
first_name: {
type: Sequelize.STRING
},
last_name: {
type: Sequelize.STRING
},
email: {
type: Sequelize.STRING
}
};
const MODEL_OPTIONS = {
underscored: true,
timestamps: true,
indexes: [{
fields: ['createdat']
}]
};
module.exports = ['Example', EXAMPLE, MODEL_OPTIONS];