30 lines
757 B
PHP
30 lines
757 B
PHP
<?php
|
|
|
|
namespace App\Libraries\DBMigration\Process;
|
|
|
|
use CodeIgniter\Database\BaseConnection;
|
|
|
|
class SwitchCodeProcess implements MigrationProcessInterface
|
|
{
|
|
private $db;
|
|
public function __construct(BaseConnection $db)
|
|
{
|
|
$this->db = $db;
|
|
}
|
|
public function process(string $site, array $row, int $cnt): void {}
|
|
public function make(): void
|
|
{
|
|
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 "SWITCHCODE 완료.\n";
|
|
}
|
|
}
|