spee.ch/server/models/metrics.js

58 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

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