69 lines
3.0 KiB
PHP
69 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateTestsTable extends Migration {
|
|
public function up() {
|
|
|
|
$this->forge->addField([
|
|
'RefNumID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
|
'TestSiteID' => ['type' => 'INT', 'null' => false],
|
|
'SpcType' => ['type' => 'varchar', 'constraint'=> 10, 'null' => false],
|
|
'Sex' => ['type' => 'INT', 'null' => true],
|
|
'AgeStart' => ['type' => 'INT', 'null' => true],
|
|
'AgeEnd' => ['type' => 'int', 'null' => true],
|
|
'CriticalLow' => ['type' => 'int', 'null' => true],
|
|
'Low' => ['type' => 'int', 'null' => true],
|
|
'High' => ['type' => 'int', 'null' => true],
|
|
'CriticalHigh' => ['type' => 'int', 'null' => true],
|
|
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
|
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
|
]);
|
|
$this->forge->addKey('RefNumID', true);
|
|
$this->forge->createTable('refnum');
|
|
|
|
$this->forge->addField([
|
|
'RefTHoldID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
|
'TestSiteID' => ['type' => 'INT', 'null' => false],
|
|
'SpcType' => ['type' => 'varchar', 'constraint'=> 10, 'null' => false],
|
|
'Sex' => ['type' => 'INT', 'null' => true],
|
|
'AgeStart' => ['type' => 'INT', 'null' => true],
|
|
'AgeEnd' => ['type' => 'int', 'null' => true],
|
|
'Threshold' => ['type' => 'int', 'null' => true],
|
|
'BelowTxt' => ['type' => 'varchar', 'constraint'=> 10, 'null' => true],
|
|
'AboveTxt' => ['type' => 'varchar', 'constraint'=> 10, 'null' => true],
|
|
'GrayZoneLow' => ['type' => 'int', 'null' => true],
|
|
'GrayZoneHigh' => ['type' => 'int', 'null' => true],
|
|
'GrayZoneTxt' => ['type' => 'varchar', 'constraint'=> 10, 'null' => true],
|
|
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
|
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
|
]);
|
|
$this->forge->addKey('RefTHoldID', true);
|
|
$this->forge->createTable('refthold');
|
|
|
|
$this->forge->addField([
|
|
'RefVSetID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
|
'TestSiteID' => ['type' => 'INT', 'null' => false],
|
|
'SpcType' => ['type' => 'varchar', 'constraint'=> 10, 'null' => false],
|
|
'Sex' => ['type' => 'INT', 'null' => true],
|
|
'AgeStart' => ['type' => 'INT', 'null' => true],
|
|
'AgeEnd' => ['type' => 'int', 'null' => true],
|
|
'RefTxt' => ['type' => 'varchar', 'constraint'=>255, 'null' => true],
|
|
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
|
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
|
]);
|
|
$this->forge->addKey('RefVSetID', true);
|
|
$this->forge->createTable('refvset');
|
|
}
|
|
|
|
public function down() {
|
|
$this->forge->dropTable('refnum');
|
|
$this->forge->dropTable('refthold');
|
|
$this->forge->dropTable('refvset');
|
|
}
|
|
} |