clqms-be/app/Database/Migrations/2026-01-01-000022_CreateResults.php
root 2bcdf09b55 chore: repo-wide normalization + rules test coverage
Normalize formatting/line endings across configs, controllers, models, tests, and OpenAPI specs.

Update rule expression/rule engine implementation and remove obsolete RuleAction controller/model.

Add unit tests for rule expression syntax and multi-action behavior, and include docs updates.
2026-03-16 07:24:50 +07:00

75 lines
3.5 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateResults extends Migration {
public function up() {
$this->forge->addField([
'ResultID' => ['type' => 'INT', 'auto_increment' => true],
'SiteID' => ['type' => 'INT', 'null' => true],
'OrderID' => ['type' => 'INT', 'null' => true],
'InternalSID' => ['type' => 'INT', 'null' => true],
'SID' => ['type' => 'varchar', 'constraint' => 30],
'SampleID' => ['type' => 'varchar', 'constraint' => 30],
'TestSiteID' => ['type' => 'INT', 'null' => true],
'TestSiteCode' => ['type' => 'CHAR', 'constraint' => 6, 'null' => true],
'AspCnt' => ['type' => 'INT', 'default' => 1, 'null' => true],
'Result' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
'SampleType' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
'ResultDateTime' => ['type' => 'DATETIME'],
'WorkstationID' => ['type' => 'INT', 'null' => true],
'EquipmentID' => ['type' => 'INT', 'null' => true],
'RefNumID' => ['type' => 'INT', 'null' => true],
'RefTxtID' => ['type' => 'INT', 'null' => true],
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true],
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true],
'DelDate' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addPrimaryKey('ResultID');
$this->forge->createTable('patres');
$this->forge->addField([
'ResFlagID' => ['type' => 'INT', 'auto_increment' => true],
'ResultID' => ['type' => 'INT', 'null' => false],
'Flag' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true],
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true],
'DelDate' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addPrimaryKey('ResFlagID');
$this->forge->createTable('patresflag');
$this->forge->addField([
'ResStatusID' => ['type' => 'INT', 'auto_increment' => true],
'ResultID' => ['type' => 'INT', 'null' => false],
'SID' => ['type' => 'varchar', 'constraint' => 30],
'TestAct' => ['type' => 'varchar', 'constraint' => 255],
'ActRes' => ['type' => 'INT', 'null' => true],
'TestStatus' => ['type' => 'INT', 'null' => true],
'CurrSiteID' => ['type' => 'INT', 'null' => true],
'CurrLocID' => ['type' => 'INT', 'null' => true],
'Origin' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
'GeoLocationSystem' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
'GeoLocationData' => ['type' => 'TEXT', 'null' => true],
'DIDType' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
'DID' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
'UserID' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
'LogDate' => ['type' => 'DATETIME', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true],
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addPrimaryKey('ResStatusID');
$this->forge->createTable('patrestatus');
}
public function down() {
$this->forge->dropTable('patrestatus');
$this->forge->dropTable('patresflag');
$this->forge->dropTable('patres');
}
}