Add last active date to member_devices table

This commit is contained in:
Kijin Sung 2020-10-28 01:16:23 +09:00
parent e87bd70e98
commit 5ea9d52b0c
6 changed files with 31 additions and 3 deletions

View file

@ -200,7 +200,9 @@ class member extends ModuleObject {
if(!$oDB->isIndexExists('member_nickname_log', 'idx_after_nick_name')) return true;
if(!$oDB->isIndexExists('member_nickname_log', 'idx_user_id')) return true;
// Add device token type and last active date 2020.10.28
if(!$oDB->isColumnExists('member_devices', 'device_token_type')) return true;
if(!$oDB->isColumnExists('member_devices', 'last_active_date')) return true;
$config = ModuleModel::getModuleConfig('member');
@ -374,7 +376,7 @@ class member extends ModuleObject {
$oDB->addIndex('member_nickname_log', 'idx_user_id', array('user_id'));
}
// Add device token type 2020.10.28
// Add device token type and last active date 2020.10.28
if(!$oDB->isColumnExists('member_devices', 'device_token_type'))
{
$oDB->addColumn('member_devices', 'device_token_type', 'varchar', '20', '', true, 'device_token');
@ -382,6 +384,12 @@ class member extends ModuleObject {
$oDB->query("UPDATE member_devices SET device_token_type = 'fcm' WHERE device_type = 'android' OR LENGTH(device_token) > 64");
$oDB->query("UPDATE member_devices SET device_token_type = 'apns' WHERE device_type = 'ios' AND LENGTH(device_token) = 64");
}
if(!$oDB->isColumnExists('member_devices', 'last_active_date'))
{
$oDB->addColumn('member_devices', 'last_active_date', 'date', '', '', true, 'regdate');
$oDB->addIndex('member_devices', 'idx_last_active_date', array('last_active_date'));
$oDB->query("UPDATE member_devices SET last_active_date = regdate WHERE last_active_date = ''");
}
$config = ModuleModel::getModuleConfig('member');
$changed = false;