From a88fb96bd39dfe010e19042a1d7839c067eedb43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Tue, 23 Dec 2025 14:18:56 +0900 Subject: [PATCH] dbmsv4 init...3 --- .../CLI/DBMigration/BaseSource.php | 17 +++++++++++------ .../DBMigration/Process/SwitchCodeProcess.php | 19 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/app/Controllers/CLI/DBMigration/BaseSource.php b/app/Controllers/CLI/DBMigration/BaseSource.php index 7391aef..51eaacd 100644 --- a/app/Controllers/CLI/DBMigration/BaseSource.php +++ b/app/Controllers/CLI/DBMigration/BaseSource.php @@ -121,13 +121,18 @@ abstract class BaseSource extends DBMigration ); } + // final public function switchcode(): void + // { + // $this->execute( + // new SWITCHCodeProcess($this->getTargetDB()), + // $this->getSWITCHCode(), + // __FUNCTION__, + // $this->getDBName() + // ); + // } final public function switchcode(): void { - $this->execute( - new SWITCHCodeProcess($this->getTargetDB()), - $this->getSWITCHCode(), - __FUNCTION__, - $this->getDBName() - ); + $processor = new SWITCHCodeProcess($this->getTargetDB()); + $processor->make(); } } diff --git a/app/Libraries/DBMigration/Process/SwitchCodeProcess.php b/app/Libraries/DBMigration/Process/SwitchCodeProcess.php index 4c34270..889d35e 100644 --- a/app/Libraries/DBMigration/Process/SwitchCodeProcess.php +++ b/app/Libraries/DBMigration/Process/SwitchCodeProcess.php @@ -11,14 +11,19 @@ class SwitchCodeProcess implements MigrationProcessInterface { $this->db = $db; } - public function process(string $site, array $row, int $cnt): void + public function process(string $site, array $row, int $cnt): void {} + public function make(): void { - $temps = []; - $temps['code'] = trim($row['service_sw']); - $temps['status'] = STATUS['AVAILABLE']; // Assuming SWITCHEntity has a STATUS_DEFAULT constant - if (!$this->db->table('switchinfo')->insert($temps)) { - throw new \Exception($this->db->error()['message']); + for ($i = 1; $i <= 88; $i++) { + for ($j = 1; $j <= 48; $j++) { + $temps = []; + $temps['code'] = sprintf("C%02dPA%02d", $i, $j); + $temps['status'] = STATUS['AVAILABLE']; + if (!$this->db->table('switchinfo')->insert($temps)) { + throw new \Exception($this->db->error()['message']); + } + } } - echo "{$cnt} -> {$temps['code']} SWITCHCODE 완료.\n"; + echo "SWITCHCODE 완료.\n"; } }