refactor: 일반 실행 경로의 DB 변경을 버전형 마이그레이션으로 이전

과거 누적 DDL과 데이터 보정을 시점별 SQL로 분리하고 관리자·CLI 실행기를 제공한다. 실행 순서, 잠금, 체크섬, 성공·실패 이력 및 개별 실행의 선행 조건을 검증한다.

기존 스키마의 부분 적용 복구와 설치 SQL 정합성 검사를 추가하고 실행·복구 절차를 문서화한다.
This commit is contained in:
whitedot
2026-09-09 07:58:05 +00:00
parent d111100856
commit 5bdbf360b0
76 changed files with 1826 additions and 2182 deletions
-87
View File
@@ -557,93 +557,6 @@ if (!function_exists('inicis_pro_audit_tables')) {
}
}
if (!function_exists('inicis_pro_audit_ensure_tables')) {
// 감사 테이블이 없으면 생성한다(스키마는 dbupgrade.php와 동일하게 유지).
function inicis_pro_audit_ensure_tables()
{
$tables = inicis_pro_audit_tables();
if (!sql_query(" DESC `{$tables['summary']}` ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$tables['summary']}` (
`ip_id` int(11) NOT NULL AUTO_INCREMENT,
`ip_oid` varchar(64) NOT NULL DEFAULT '',
`ip_tid` varchar(80) NOT NULL DEFAULT '',
`ip_auth_tid` varchar(80) NOT NULL DEFAULT '',
`ip_mid` varchar(80) NOT NULL DEFAULT '',
`ip_environment` varchar(10) NOT NULL DEFAULT '',
`mb_id` varchar(20) NOT NULL DEFAULT '',
`ip_amount` int(11) NOT NULL DEFAULT '0',
`ip_pay_type` varchar(20) NOT NULL DEFAULT '',
`ip_easy_pay` varchar(20) NOT NULL DEFAULT '',
`ip_device` varchar(10) NOT NULL DEFAULT '',
`ip_order_type` varchar(10) NOT NULL DEFAULT '',
`ip_status` varchar(30) NOT NULL DEFAULT '',
`ip_result_code` varchar(30) NOT NULL DEFAULT '',
`ip_result_message` varchar(255) NOT NULL DEFAULT '',
`ip_noti_status` varchar(30) NOT NULL DEFAULT '',
`ip_noti_code` varchar(30) NOT NULL DEFAULT '',
`ip_noti_message` varchar(255) NOT NULL DEFAULT '',
`ip_noti_failed_count` int(11) NOT NULL DEFAULT '0',
`ip_noti_at` datetime DEFAULT NULL,
`ip_cancel_status` varchar(30) NOT NULL DEFAULT '',
`ip_cancel_code` varchar(30) NOT NULL DEFAULT '',
`ip_cancel_message` varchar(255) NOT NULL DEFAULT '',
`ip_cancel_checked_at` datetime DEFAULT NULL,
`ip_refund_required` tinyint(4) NOT NULL DEFAULT '0',
`ip_vbank_due_at` datetime DEFAULT NULL,
`ip_expired_at` datetime DEFAULT NULL,
`ip_order_exists` tinyint(4) NOT NULL DEFAULT '0',
`ip_approved_at` datetime DEFAULT NULL,
`ip_ordered_at` datetime DEFAULT NULL,
`ip_notified_at` datetime DEFAULT NULL,
`ip_canceled_at` datetime DEFAULT NULL,
`ip_created_at` datetime DEFAULT NULL,
`ip_updated_at` datetime DEFAULT NULL,
`ip_ip` varchar(45) NOT NULL DEFAULT '',
`ip_event_count` int(11) NOT NULL DEFAULT '0',
`ip_audit_error` tinyint(4) NOT NULL DEFAULT '0',
`ip_alerted_at` datetime DEFAULT NULL,
`ip_alert_key` varchar(64) NOT NULL DEFAULT '',
`ip_pg_status` varchar(30) NOT NULL DEFAULT '',
`ip_pg_amount` int(11) NOT NULL DEFAULT '0',
`ip_pg_tid` varchar(80) NOT NULL DEFAULT '',
`ip_pg_result_code` varchar(30) NOT NULL DEFAULT '',
`ip_pg_message` varchar(255) NOT NULL DEFAULT '',
`ip_pg_checked_at` datetime DEFAULT NULL,
PRIMARY KEY (`ip_id`),
UNIQUE KEY `ip_oid` (`ip_oid`),
KEY `ip_tid` (`ip_tid`),
KEY `ip_auth_tid` (`ip_auth_tid`),
KEY `ip_status` (`ip_status`),
KEY `ip_noti_status` (`ip_noti_status`),
KEY `ip_cancel_status` (`ip_cancel_status`),
KEY `ip_refund_required` (`ip_refund_required`),
KEY `ip_updated_at` (`ip_updated_at`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", false);
}
if (!sql_query(" DESC `{$tables['event']}` ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$tables['event']}` (
`pe_id` int(11) NOT NULL AUTO_INCREMENT,
`ip_oid` varchar(64) NOT NULL DEFAULT '',
`ip_tid` varchar(80) NOT NULL DEFAULT '',
`pe_stage` varchar(30) NOT NULL DEFAULT '',
`pe_status` varchar(30) NOT NULL DEFAULT '',
`pe_code` varchar(30) NOT NULL DEFAULT '',
`pe_message` varchar(255) NOT NULL DEFAULT '',
`pe_source` varchar(10) NOT NULL DEFAULT '',
`pe_ip` varchar(45) NOT NULL DEFAULT '',
`pe_created_at` datetime DEFAULT NULL,
PRIMARY KEY (`pe_id`),
KEY `ip_oid` (`ip_oid`),
KEY `ip_tid` (`ip_tid`),
KEY `pe_status` (`pe_status`),
KEY `pe_created_at` (`pe_created_at`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", false);
}
}
}
if (!function_exists('inicis_pro_audit_tables_ready')) {
function inicis_pro_audit_tables_ready()
{
-9
View File
@@ -41,15 +41,6 @@ if (get_cart_count($tmp_cart_id) == 0) { // 장바구니에 담기
alert('장바구니가 비어 있습니다.\\n\\n이미 주문하셨거나 장바구니에 담긴 상품이 없는 경우입니다.', G5_SHOP_URL.'/cart.php');
}
$sql = "select * from {$g5['g5_shop_order_table']} limit 1";
$check_tmp = sql_fetch($sql);
if(!isset($check_tmp['od_other_pay_type'])){
$sql = "ALTER TABLE `{$g5['g5_shop_order_table']}`
ADD COLUMN `od_other_pay_type` VARCHAR(100) NOT NULL DEFAULT '' AFTER `od_settle_case`; ";
sql_query($sql, false);
}
// 변수 초기화
$od_other_pay_type = '';