불필요한 스키마 제거

This commit is contained in:
BJRambo 2021-02-03 12:33:23 +09:00
parent b6a7b8bd7f
commit c6614a9d02
3 changed files with 35 additions and 4 deletions

View file

@ -78,7 +78,7 @@ class ncenterlite extends ModuleObject
}
}
foreach(NcenterliteModel::getNotifyTypes() as $type => $srl)
foreach(NcenterliteModel::getUserSetNotifyTypes() as $type => $srl)
{
if(!$oDB->isColumnExists('ncenterlite_user_set', $type . '_notify'))
{
@ -100,6 +100,16 @@ class ncenterlite extends ModuleObject
return true;
}
if($oDB->isColumnExists('ncenterlite_user_set','admin_content_notify'))
{
return true;
}
if($oDB->isColumnExists('ncenterlite_user_set','custom_notify'))
{
return true;
}
$config = getModel('ncenterlite')->getConfig();
$member_config = getModel('member')->getMemberConfig();
@ -172,7 +182,7 @@ class ncenterlite extends ModuleObject
}
$prev_type = '';
foreach(NcenterliteModel::getNotifyTypes() as $type => $srl)
foreach(NcenterliteModel::getUserSetNotifyTypes() as $type => $srl)
{
if(!$oDB->isColumnExists('ncenterlite_user_set', $type . '_notify'))
{
@ -188,6 +198,17 @@ class ncenterlite extends ModuleObject
}
$prev_type = $type;
}
// Not use the column
if($oDB->isColumnExists('ncenterlite_user_set','admin_content_notify'))
{
$oDB->dropColumn('ncenterlite_user_set', 'admin_content_notify');
}
if($oDB->isColumnExists('ncenterlite_user_set','custom_notify'))
{
$oDB->dropColumn('ncenterlite_user_set', 'custom_notify');
}
// Composite index to speed up getNotifyList
if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_member_srl_and_readed'))

View file

@ -114,6 +114,18 @@ class ncenterliteModel extends ncenterlite
$default['custom'] = 0;
return $default;
}
public static function getUserSetNotifyTypes()
{
return array(
'comment' => 0,
'comment_comment' => 0,
'mention' => 0,
'vote' => 0,
'scrap' => 0,
'message' => 0,
);
}
function getNotifyTypebySrl($notify_srl)
{

View file

@ -6,7 +6,5 @@
<column name="vote_notify" type="varchar" size="40" notnull="notnull" />
<column name="scrap_notify" type="varchar" size="40" notnull="notnull" />
<column name="message_notify" type="varchar" size="40" notnull="notnull" />
<column name="admin_content_notify" type="varchar" size="40" notnull="notnull" />
<column name="custom_notify" type="varchar" size="40" notnull="notnull" />
<column name="regdate" type="date" index="idx_regdate" />
</table>