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