92 lines
4.3 KiB
PHP
92 lines
4.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Database\Migrations;
|
||
|
|
|
||
|
|
use CodeIgniter\Database\Migration;
|
||
|
|
|
||
|
|
class CreatePatresTables 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],
|
||
|
|
'RefTHoldID' => ['type' => 'INT', 'null' => true],
|
||
|
|
'RefVSetID' => ['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');
|
||
|
|
|
||
|
|
$this->forge->addField([
|
||
|
|
'FlagDefID' => ['type' => 'INT', 'auto_increment' => true],
|
||
|
|
'InstrumentName' => ['type' => 'varchar', 'constraint' => 100, 'null' => true],
|
||
|
|
'Flag' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
|
||
|
|
'FlagText' => ['type' => 'varchar', 'constraint' => 100, 'null' => true],
|
||
|
|
'FlagDesc' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||
|
|
'OnScreen' => ['type' => 'int', 'null' => true],
|
||
|
|
'OnResult' => ['type' => 'int', 'null' => true],
|
||
|
|
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||
|
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||
|
|
]);
|
||
|
|
$this->forge->addPrimaryKey('FlagDefID');
|
||
|
|
$this->forge->createTable('flagdef');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function down() {
|
||
|
|
$this->forge->dropTable('flagdef', true);
|
||
|
|
$this->forge->dropTable('patrestatus', true);
|
||
|
|
$this->forge->dropTable('patrestech', true);
|
||
|
|
$this->forge->dropTable('patresflag', true);
|
||
|
|
$this->forge->dropTable('patres', true);
|
||
|
|
}
|
||
|
|
}
|