add specimen migration
This commit is contained in:
parent
c983ed20c2
commit
862c6ca8b4
@ -15,9 +15,9 @@ class CreateLocationTable extends Migration {
|
||||
'LocFull' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||
'Description' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||
'LocType' => ['type' => 'varchar', 'constraint' => 11, 'null' => true],
|
||||
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
||||
]);
|
||||
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||
$this->forge->addKey('LocationID', true);
|
||||
$this->forge->createTable('location');
|
||||
|
||||
@ -30,9 +30,9 @@ class CreateLocationTable extends Migration {
|
||||
'PostCode' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||
'GeoLocationSystem' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||
'GeoLocationData' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
||||
]);
|
||||
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||
$this->forge->addKey('LocationID', true);
|
||||
$this->forge->createTable('locationaddress');
|
||||
}
|
||||
|
||||
135
app/Database/Migrations/2025-10-07-132705_Specimen.php
Normal file
135
app/Database/Migrations/2025-10-07-132705_Specimen.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateSpecimenTable extends Migration {
|
||||
public function up() {
|
||||
|
||||
$this->forge->addField([
|
||||
'ConDefID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||
'SiteID' => ['type' => 'INT', 'null' => true],
|
||||
'ConCode' => ['type' => 'VARCHAR', 'constraint' => 3, 'null' => false],
|
||||
'ConName' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
|
||||
'ConDesc' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
|
||||
'Additive' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
|
||||
'ConClass' => ['type' => 'int', 'null' => false],
|
||||
'Color' => ['type' => 'int', 'null' => false],
|
||||
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
||||
]);
|
||||
$this->forge->addKey('ConDefID', true);
|
||||
$this->forge->addUniqueKey('ConCode');
|
||||
$this->forge->createTable('containerdef');
|
||||
|
||||
$this->forge->addField([
|
||||
'InternalSID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||
'SID' => ['type' => 'VARCHAR', 'constraint' => 30, 'null' => false],
|
||||
'SiteID' => ['type' => 'INT', 'null' => true],
|
||||
'OrderID' => ['type' => 'INT', 'null' => true],
|
||||
'ConDefID' => ['type' => 'INT', 'null' => true],
|
||||
'Parent' => ['type' => 'int', 'null' => true],
|
||||
'Qty' => ['type' => 'INT', 'null' => true],
|
||||
'Unit' => ['type' => 'varchar', 'constraint'=> 30, 'null' => true],
|
||||
'GenerateBy' => ['type' => 'int', 'null' => true],
|
||||
'SchDateTime' => ['type' => 'datetime', 'null' => true],
|
||||
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true]
|
||||
]);
|
||||
$this->forge->addKey('InternalSID', true);
|
||||
$this->forge->addUniqueKey('SID');
|
||||
$this->forge->createTable('specimens');
|
||||
|
||||
$this->forge->addField([
|
||||
'SpcStaID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||
'SID' => ['type' => 'VARCHAR', 'constraint' => 30, 'null' => false],
|
||||
'SpcAct' => ['type' => 'varchar', 'constraint' => 15, 'null' => true],
|
||||
'ActRes' => ['type' => 'INT', 'null' => true],
|
||||
'SpcStatus' => ['type' => 'int', 'null' => true],
|
||||
'Qty' => ['type' => 'INT', 'null' => true],
|
||||
'Unit' => ['type' => 'INT', 'null' => true], //['type' => 'varchar' , 'constraint'=> 30, 'null' => true],
|
||||
'SpcCon' => ['type' => 'INT', 'null' => true], //['type' => 'varchar', 'constraint'=> 30, 'null' => true],
|
||||
'Comment' => ['type' => 'varchar', 'constraint'=>150, 'null' => true],
|
||||
'CurrSiteID' => ['type' => 'int', 'null' => true ],
|
||||
'CurrLocID' => ['type' => 'int', 'null' => true ],
|
||||
'Origin' => ['type' => 'varchar', 'constraint'=>50, 'null' => true ],
|
||||
'GeoLocationSystem' => ['type' => 'varchar', 'constraint'=>10, 'null' => true ],
|
||||
'GeoLocationData' => ['type' => 'varchar', 'constraint'=>10, 'null' => true ],
|
||||
'DIDType' => ['type' => 'varchar', 'constraint'=>10, 'null' => true ],
|
||||
'DID' => ['type' => 'varchar', 'constraint'=>10, 'null' => true ],
|
||||
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true]
|
||||
]);
|
||||
$this->forge->addKey('SpcStaSID', true);
|
||||
$this->forge->createTable('specimenstatus');
|
||||
|
||||
$this->forge->addField([
|
||||
'SpcColID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||
'SpcStaID' => ['type' => 'INT', 'unsigned' => true],
|
||||
'SpcRole' => ['type' => 'varchar', 'constraint' => 15, 'null' => true],
|
||||
'ColMethod' => ['type' => 'varchar', 'constraint' => 15, 'null' => true],
|
||||
'BodySite' => ['type' => 'varchar', 'constraint' => 15, 'null' => true],
|
||||
'CntSize' => ['type' => 'INT', 'null' => true],
|
||||
'FastingVolume' => ['type' => 'varchar', 'constraint'=> 2, 'null' => true],
|
||||
'ColStart' => ['type' => 'datetime', 'null' => true],
|
||||
'ColEnd' => ['type' => 'datetime', 'null' => true],
|
||||
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true]
|
||||
]);
|
||||
$this->forge->addKey('SpcColID', true);
|
||||
$this->forge->createTable('specimencollection');
|
||||
|
||||
$this->forge->addField([
|
||||
'SpcPrpID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||
'SpcStaID' => ['type' => 'INT', 'unsigned' => true],
|
||||
'Description' => ['type' => 'varchar', 'constraint' => 150, 'null' => true],
|
||||
'Method' => ['type' => 'varchar', 'constraint' => 15, 'null' => true],
|
||||
'Additive' => ['type' => 'varchar', 'constraint' => 15, 'null' => true],
|
||||
'AddQty' => ['type' => 'float', 'null' => true],
|
||||
'AddUnit' => ['type' => 'varchar', 'constraint'=> 15, 'null' => true],
|
||||
'PrepStart' => ['type' => 'datetime', 'null' => true],
|
||||
'PrepEnd' => ['type' => 'datetime', 'null' => true],
|
||||
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true]
|
||||
]);
|
||||
$this->forge->addKey('SpcPrpID', true);
|
||||
$this->forge->createTable('specimenprep');
|
||||
|
||||
$this->forge->addField([
|
||||
'SpcLogID'=> ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'TblName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'RecID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'FldName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'FldValuePrev'=> ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'UserID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'DIDType' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'DID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'MachineID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'SessionID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'AppID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ProcessID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'WebPageID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'LogDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP'
|
||||
]);
|
||||
$this->forge->addKey('SpcLogID', true);
|
||||
$this->forge->createTable('specimenlog');
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->forge->dropTable('containerdef');
|
||||
$this->forge->dropTable('specimens');
|
||||
$this->forge->dropTable('specimenstatus');
|
||||
$this->forge->dropTable('specimencollection');
|
||||
$this->forge->dropTable('specimenprep');
|
||||
$this->forge->dropTable('specimenlog');
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user