Make all module columns varchar(80)

utf8mb4 길이 제한 때문에 module_part_config 테이블에 인덱스가 추가되지 않는 문제 수정.
다른 테이블에서 module 컬럼은 이미 80자로 제한되어 있으므로 이 테이블에서만 길게 허용할 필요가 없음.
This commit is contained in:
Kijin Sung 2018-06-26 10:19:28 +09:00
parent 62895c945a
commit 6c28f5ac5a
3 changed files with 32 additions and 12 deletions

View file

@ -114,6 +114,11 @@ class module extends ModuleObject
{ {
return true; return true;
} }
$column_info = $oDB->getColumnInfo('module_part_config', 'module');
if($column_info->size > 80)
{
return true;
}
// check module_config data type // check module_config data type
$column_info = $oDB->getColumnInfo('module_config', 'config'); $column_info = $oDB->getColumnInfo('module_config', 'config');
@ -121,6 +126,11 @@ class module extends ModuleObject
{ {
return true; return true;
} }
$column_info = $oDB->getColumnInfo('module_config', 'module');
if($column_info->size > 80)
{
return true;
}
} }
/** /**
@ -401,14 +411,16 @@ class module extends ModuleObject
$output = $oModuleController->updateModuleConfig('module', $moduleConfig); $output = $oModuleController->updateModuleConfig('module', $moduleConfig);
} }
// check unique index on module_part_config // check module_config data type
if($oDB->isIndexExists('module_part_config', 'idx_module_part_config')) $column_info = $oDB->getColumnInfo('module_config', 'config');
if($column_info->xetype !== 'bigtext')
{ {
$oDB->dropIndex('module_part_config', 'idx_module_part_config'); $oDB->modifyColumn('module_config', 'config', 'bigtext');
} }
if(!$oDB->isIndexExists('module_part_config', 'unique_module_part_config')) $column_info = $oDB->getColumnInfo('module_config', 'module');
if($column_info->size > 80)
{ {
$oDB->addIndex('module_part_config', 'unique_module_part_config', array('module', 'module_srl'), true); $oDB->modifyColumn('module_config', 'module', 'varchar', 80, '', true);
} }
// check module_part_config data type // check module_part_config data type
@ -417,12 +429,20 @@ class module extends ModuleObject
{ {
$oDB->modifyColumn('module_part_config', 'config', 'bigtext'); $oDB->modifyColumn('module_part_config', 'config', 'bigtext');
} }
$column_info = $oDB->getColumnInfo('module_part_config', 'module');
// check module_config data type if($column_info->size > 80)
$column_info = $oDB->getColumnInfo('module_config', 'config');
if($column_info->xetype !== 'bigtext')
{ {
$oDB->modifyColumn('module_config', 'config', 'bigtext'); $oDB->modifyColumn('module_part_config', 'module', 'varchar', 80, '', true);
}
// check unique index on module_part_config
if($oDB->isIndexExists('module_part_config', 'idx_module_part_config'))
{
$oDB->dropIndex('module_part_config', 'idx_module_part_config');
}
if(!$oDB->isIndexExists('module_part_config', 'unique_module_part_config'))
{
$oDB->addIndex('module_part_config', 'unique_module_part_config', array('module', 'module_srl'), true);
} }
} }

View file

@ -1,5 +1,5 @@
<table name="module_config"> <table name="module_config">
<column name="module" type="varchar" size="250" notnull="notnull" primary_key="primary_key" /> <column name="module" type="varchar" size="80" notnull="notnull" primary_key="primary_key" />
<column name="site_srl" type="number" size="11" notnull="notnull" /> <column name="site_srl" type="number" size="11" notnull="notnull" />
<column name="config" type="bigtext" /> <column name="config" type="bigtext" />
<column name="regdate" type="date" /> <column name="regdate" type="date" />

View file

@ -1,5 +1,5 @@
<table name="module_part_config"> <table name="module_part_config">
<column name="module" type="varchar" size="180" notnull="notnull" unique="unique_module_part_config" utf8mb4="false" /> <column name="module" type="varchar" size="80" notnull="notnull" unique="unique_module_part_config" utf8mb4="false" />
<column name="module_srl" type="number" size="11" notnull="notnull" unique="unique_module_part_config" /> <column name="module_srl" type="number" size="11" notnull="notnull" unique="unique_module_part_config" />
<column name="config" type="bigtext" /> <column name="config" type="bigtext" />
<column name="regdate" type="date" /> <column name="regdate" type="date" />