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: {
|
|
|
|
type: DATE(6),
|
|
|
|
defaultValue: sequelize.NOW,
|
|
|
|
},
|
|
|
|
isInternal: {
|
|
|
|
type: BOOLEAN,
|
|
|
|
},
|
2018-10-09 20:10:06 +02:00
|
|
|
isChannel: {
|
|
|
|
type: BOOLEAN,
|
|
|
|
defaultValue: false,
|
|
|
|
},
|
2018-10-09 02:02:05 +02:00
|
|
|
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: [
|
|
|
|
{
|
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
|
|
|
};
|