clqms-be/app/Database/Migrations/2026-02-27-001500_CreateHostAppAndCodingSys.php
root 30c4e47304 chore(repo): normalize EOL and harden contact patch flow
- handle contact PATCH failures by checking model save result and returning HTTP 400 with the model error message
- update ContactDetailModel nested updates to enforce active-detail checks and use model update() with explicit failure propagation
- extend contact patch assertions and align test-create variants expectations to status=success for POST responses
- refresh composer lock metadata/dependency constraints and include generated docs/data/test files updated during normalization
- impact: API contract unchanged except clearer 400 error responses on invalid contact detail updates
2026-04-17 05:38:11 +07:00

51 lines
2.1 KiB
PHP
Executable File

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateHostAppAndCodingSys extends Migration {
public function up() {
// Table: hostapp
$this->forge->addField([
'HostAppID' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
'HostAppName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => false],
'SiteID' => ['type' => 'INT', 'unsigned' => true, 'null' => true],
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true]
]);
$this->forge->addKey('HostAppID', true);
$this->forge->createTable('hostapp');
// Table: hostcompara
$this->forge->addField([
'HostAppID' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
'HostIP' => ['type' => 'VARCHAR', 'constraint' => 15, 'null' => true],
'HostPort' => ['type' => 'VARCHAR', 'constraint' => 6, 'null' => true],
'HostPwd' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true]
]);
$this->forge->addKey('HostAppID', true);
$this->forge->createTable('hostcompara');
// Table: codingsys
$this->forge->addField([
'CodingSysID' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
'CodingSysAbb' => ['type' => 'VARCHAR', 'constraint' => 6, 'null' => false, 'unique' => true],
'FullText' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'Description' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true]
]);
$this->forge->addKey('CodingSysID', true);
$this->forge->createTable('codingsys');
}
public function down() {
$this->forge->dropTable('codingsys');
$this->forge->dropTable('hostcompara');
$this->forge->dropTable('hostapp');
}
}