diff --git a/app/Controllers/CLI/DBMigration/BaseSource.php b/app/Controllers/CLI/DBMigration/BaseSource.php index c420d87..02dc3e4 100644 --- a/app/Controllers/CLI/DBMigration/BaseSource.php +++ b/app/Controllers/CLI/DBMigration/BaseSource.php @@ -20,7 +20,7 @@ abstract class BaseSource extends DBMigration */ private const SQL_GET_CLIENT = "SELECT * FROM clientdb"; private const SQL_GET_LINE = "SELECT Line_code, line_case, Line_ip, line_client_name, line_gateway, line_id, line_pass, line_name, line_haveip, line_phone, line_mainip FROM linedb"; - private const SQL_GET_SERVER_CODE = "SELECT DISTINCT(server_code) FROM serverdb WHERE server_code NOT LIKE ?"; + private const SQL_GET_SERVER_CODE = "SELECT server_code,server_use_status,server_cost,server_release_date FROM serverdb WHERE server_code NOT LIKE ?"; private const SQL_GET_SWITCH_CODE = "SELECT DISTINCT(service_sw) FROM servicedb WHERE service_sw NOT LIKE ?"; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) diff --git a/app/Database/dbmsv4_init.sql b/app/Database/dbmsv4_init.sql index b227d21..61c3645 100644 --- a/app/Database/dbmsv4_init.sql +++ b/app/Database/dbmsv4_init.sql @@ -536,8 +536,8 @@ CREATE TABLE `serverinfo` ( `os` varchar(30) DEFAULT NULL, `title` varchar(50) NOT NULL, `price` int(11) NOT NULL, - `manufactur_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '제조일', - `format_at` timestamp NULL DEFAULT NULL COMMENT '포맷보류일', + `manufactur_at` date NOT NULL, + `format_at` date DEFAULT NULL, `status` varchar(20) NOT NULL DEFAULT 'available', `updated_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), @@ -762,4 +762,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-12-22 17:26:46 +-- Dump completed on 2025-12-23 10:12:24 diff --git a/app/Database/dbmsv4_test1.sql b/app/Database/dbmsv4_test1.sql index e2305a5..dd7798e 100644 --- a/app/Database/dbmsv4_test1.sql +++ b/app/Database/dbmsv4_test1.sql @@ -536,8 +536,8 @@ CREATE TABLE `serverinfo` ( `os` varchar(30) DEFAULT NULL, `title` varchar(50) NOT NULL, `price` int(11) NOT NULL, - `manufactur_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '제조일', - `format_at` timestamp NULL DEFAULT NULL COMMENT '포맷보류일', + `manufactur_at` date NOT NULL, + `format_at` date DEFAULT NULL, `status` varchar(20) NOT NULL DEFAULT 'available', `updated_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), @@ -762,4 +762,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-12-22 17:26:54 +-- Dump completed on 2025-12-23 10:12:15 diff --git a/app/Helpers/Equipment/ServerHelper.php b/app/Helpers/Equipment/ServerHelper.php index d2b5a15..7b72bb5 100644 --- a/app/Helpers/Equipment/ServerHelper.php +++ b/app/Helpers/Equipment/ServerHelper.php @@ -53,10 +53,6 @@ class ServerHelper extends EquipmentHelper case 'price': $value = number_format($value) . "원"; break; - case 'manufactur_at': - case 'format_at': - $value = $value ? date("Y-m-d", strtotime($value)) : ""; - break; case 'part': $value = view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [ 'serverinfo_uid' => $viewDatas['entity']->getPK(), diff --git a/app/Libraries/DBMigration/Process/ServerCodeProcess.php b/app/Libraries/DBMigration/Process/ServerCodeProcess.php index a0b7aff..9298c3b 100644 --- a/app/Libraries/DBMigration/Process/ServerCodeProcess.php +++ b/app/Libraries/DBMigration/Process/ServerCodeProcess.php @@ -13,11 +13,15 @@ class ServerCodeProcess implements MigrationProcessInterface } public function process(string $site, array $row, int $cnt): void { + //server_use_status => y이면 사용중 $temps = []; $temps['code'] = trim($row['server_code']); - $temps['amount'] = trim($row['server_disuse_date']) === 'y' ? 0 : intval($row['server_cost']); - $temps['status'] = trim($row['server_disuse_date']) === 'y' ? STATUS['AVAILABLE'] : STATUS['OCCUPIED']; - if (!$this->db->table('codeinfo')->insert($temps)) { + $temps['type'] = SERVER['TYPES']['NORMAL']; + $temps['chassisinfo_uid'] = 1; + $temps['price'] = trim($row['server_use_status']) === 'y' ? 0 : intval($row['server_cost']); + $temps['status'] = trim($row['server_use_status']) === 'y' ? STATUS['AVAILABLE'] : STATUS['OCCUPIED']; + $temps['manufactur_at'] = trim($row['server_release_date']); + if (!$this->db->table('serverinfo')->insert($temps)) { throw new \Exception($this->db->error()['message']); } echo "{$cnt} -> {$temps['code']} SERVERCODE 완료.\n";