fix some ipinfo table formats

This commit is contained in:
HF 2022-08-01 21:37:11 +02:00
parent 261540422c
commit e8b6351da0

View File

@ -27,11 +27,11 @@ const IPInfo = sequelize.define('IPInfo', {
},
org: {
type: DataTypes.CHAR(60),
type: `${DataTypes.CHAR(60)} CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci`,
},
descr: {
type: DataTypes.CHAR(60),
type: `${DataTypes.CHAR(60)} CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci`,
},
asn: {
@ -49,7 +49,7 @@ const IPInfo = sequelize.define('IPInfo', {
* proxycheck
*/
pcheck: {
type: DataTypes.CHAR(60),
type: `${DataTypes.CHAR(60)} CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci`,
},
}, {
getterMethods: {
@ -64,6 +64,11 @@ const IPInfo = sequelize.define('IPInfo', {
this.setDataValue('proxy', num);
},
asn(value) {
const asn = value.split(',')[0];
this.setDataValue('asn', asn);
},
org(value) {
this.setDataValue('org', value.slice(0, 60));
},