spee.ch/server/models/metrics.js
2018-11-12 14:31:34 -05:00

58 lines
1.2 KiB
JavaScript

module.exports = (sequelize, { BOOLEAN, DATE, STRING }) => {
const Metrics = sequelize.define(
'Metrics',
{
time: {
type : DATE(6),
defaultValue: sequelize.NOW,
},
isInternal: {
type: BOOLEAN,
},
isChannel: {
type : BOOLEAN,
defaultValue: false,
},
claimId: {
type : STRING,
defaultValue: null,
},
ip: {
type : STRING,
defaultValue: null,
},
request: {
type : STRING,
defaultValue: null,
},
userAgent: {
type : STRING,
defaultValue: null,
},
referrer: {
type : STRING,
defaultValue: null,
},
routePath: {
type : STRING,
defaultValue: null,
},
params: {
type : STRING,
defaultValue: null,
},
},
{
freezeTableName: true,
timestamps : false, // don't use default timestamps columns
indexes : [
{
fields: ['isInternal', 'isChannel', 'time', 'claimId', 'routePath'],
},
],
}
);
return Metrics;
};