From 5e60bfcb5feedf43c271e42adf09dd2a8634a703 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Tue, 21 Oct 2025 15:37:57 +0700 Subject: [PATCH 1/2] adding test management migration --- ...t.php => 2025-10-11-100001_Order_Test.php} | 9 +- .../2025-10-11-100001_Test_Management.php | 124 ++++++++++++++++++ 2 files changed, 127 insertions(+), 6 deletions(-) rename app/Database/Migrations/{2025-09-12-100001_Order_Test.php => 2025-10-11-100001_Order_Test.php} (95%) create mode 100644 app/Database/Migrations/2025-10-11-100001_Test_Management.php diff --git a/app/Database/Migrations/2025-09-12-100001_Order_Test.php b/app/Database/Migrations/2025-10-11-100001_Order_Test.php similarity index 95% rename from app/Database/Migrations/2025-09-12-100001_Order_Test.php rename to app/Database/Migrations/2025-10-11-100001_Order_Test.php index a94b01f..3dec2a4 100644 --- a/app/Database/Migrations/2025-09-12-100001_Order_Test.php +++ b/app/Database/Migrations/2025-10-11-100001_Order_Test.php @@ -14,7 +14,6 @@ class CreateOrdersTable extends Migration { 'SiteID' => ['type' => 'VARCHAR', 'constraint'=> 15, 'null' => false], 'PVADTID' => ['type' => 'INT', 'null' => false], 'ReqApp' => ['type' => 'VARCHAR', 'constraint'=> 15, 'null' => true], - 'LocationID' => ['type' => 'INT', 'null' => false], 'Priority' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], 'TrnDate' => ['type' => 'Datetime', 'null' => true], 'EffDate' => ['type' => 'Datetime', 'null' => true], @@ -28,10 +27,9 @@ class CreateOrdersTable extends Migration { $this->forge->createTable('ordertest'); $this->forge->addField([ - 'InternalOID' => ['type' => 'INT', 'null' => false], 'OrderComID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], + 'InternalOID' => ['type' => 'INT', 'null' => false], 'Comment' => ['type' => 'text', 'null' => true], - 'UserID' => ['type' => 'INT', 'null' => false], 'CreateDate' => ['type' => 'Datetime', 'null' => true], 'EndDate' => ['type' => 'Datetime', 'null' => true], 'ArchiveDate' => ['type' => 'Datetime', 'null' => true], @@ -41,10 +39,9 @@ class CreateOrdersTable extends Migration { $this->forge->createTable('ordercom'); $this->forge->addField([ - 'InternalOID' => ['type' => 'INT', 'null' => false], 'OrderAttID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], + 'InternalOID' => ['type' => 'INT', 'null' => false], 'Address' => ['type' => 'varchar', 'constraint'=>255, 'null' => true], - 'UserID' => ['type' => 'INT', 'null' => false], 'CreateDate' => ['type' => 'Datetime', 'null' => true], 'EndDate' => ['type' => 'Datetime', 'null' => true], 'ArchiveDate' => ['type' => 'Datetime', 'null' => true], @@ -54,8 +51,8 @@ class CreateOrdersTable extends Migration { $this->forge->createTable('orderatt'); $this->forge->addField([ - 'InternalOID' => ['type' => 'INT', 'null' => false], 'OrderStatID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], + 'InternalOID' => ['type' => 'INT', 'null' => false], 'OrderStatus' => ['type' => 'varchar', 'constraint'=>2, 'null' => false], 'CreateDate' => ['type' => 'Datetime', 'null' => true], 'EndDate' => ['type' => 'Datetime', 'null' => true], diff --git a/app/Database/Migrations/2025-10-11-100001_Test_Management.php b/app/Database/Migrations/2025-10-11-100001_Test_Management.php new file mode 100644 index 0000000..b487db9 --- /dev/null +++ b/app/Database/Migrations/2025-10-11-100001_Test_Management.php @@ -0,0 +1,124 @@ +forge->addField([ + 'TestID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], + 'ParenTest' => ['type' => 'INT', 'null' => true], + 'TestCode' => ['type' => 'VARCHAR', 'constraint'=> 6, 'null' => false], + 'TestName' => ['type' => 'varchar', 'constraint'=> 50, 'null' => false], + 'Description' => ['type' => 'VARCHAR', 'constraint'=> 150, 'null' => false], + 'Method' => ['type' => 'varchar', 'constraint'=>50, 'null' => true], + 'Seq' => ['type' => 'int', 'constraint'=> 15, 'null' => true], + 'CountStat' => ['type' => 'int' ], + 'CreateDate' => ['type' => 'Datetime', 'null' => true], + 'EndDate' => ['type' => 'Datetime', 'null' => true], + ]); + $this->forge->addKey('TestID', true); + $this->forge->createTable('testdef'); + + $this->forge->addField([ + 'TestSiteID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], + 'SiteID' => ['type' => 'INT', 'null' => false], + 'TestSiteCode' => ['type' => 'varchar', 'constraint'=> 6, 'null' => false], + 'TestSiteName' => ['type' => 'varchar', 'constraint'=> 50, 'null' => false], + 'Type' => ['type' => 'int', 'null' => false], + 'Description' => ['type' => 'varchar', 'constraint'=> 150, 'null' => true], + 'SeqScr' => ['type' => 'int', 'null' => false], + 'SeqRpt' => ['type' => 'int', 'null' => false], + 'IndentLeft' => ['type' => 'int', 'null' => false], + 'VisibleScr' => ['type' => 'int', 'null' => false], + 'VisibleRpt' => ['type' => 'int', 'null' => false], + 'CountStat' => ['type' => 'int', 'null' => false], + 'CreateDate' => ['type' => 'Datetime', 'null' => true], + 'EndDate' => ['type' => 'Datetime', 'null' => true], + ]); + $this->forge->addKey('TestSiteID', true); + $this->forge->createTable('testdefsite'); + + $this->forge->addField([ + 'TestTechID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], + 'SiteID' => ['type' => 'INT', 'null' => true], + 'TestSiteID' => ['type' => 'INT', 'null' => true], + 'DisciplineID' => ['type' => 'int', 'null' => true], + 'DepartmentID' => ['type' => 'int', 'null' => true], + 'WorkstationID' => ['type' => 'int', 'null' => true], + 'EquipmentID' => ['type' => 'int', 'null' => true], + 'VSet' => ['type' => 'int', 'null' => true], + 'SpcType' => ['type' => 'int', 'null' => true], + 'ReqQty' => ['type' => 'int', 'null' => true], + 'ReqQtyUnit' => ['type' => 'varchar', 'constraint'=>20, 'null' => true], + 'Unit1' => ['type' => 'varchar', 'constraint'=>20, 'null' => true], + 'Factor' => ['type' => 'int', 'null' => true], + 'Unit2' => ['type' => 'varchar', 'constraint'=>20, 'null' => true], + 'Decimal' => ['type' => 'int', 'null' => true], + 'Collreq' => ['type' => 'varchar', 'constraint'=>50, 'null' => true], + 'ConDefID' => ['type' => 'int', 'null' => true], + 'TestTechCode' => ['type' => 'varchar', 'constraint'=>6, 'null' => true], + 'TestTechAbb' => ['type' => 'varchar', 'constraint'=>50, 'null' => true], + 'TestTechName' => ['type' => 'varchar', 'constraint'=>150, 'null' => true], + 'Method' => ['type' => 'varchar', 'constraint'=>50, 'null' => true], + 'CreateDate' => ['type' => 'Datetime', 'null' => true], + 'EndDate' => ['type' => 'Datetime', 'null' => true] + ]); + $this->forge->addKey('TestTechID', true); + $this->forge->createTable('testdeftech'); + + $this->forge->addField([ + 'TestCalID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], + 'SiteID' => ['type' => 'INT', 'null' => true], + 'TestSiteID' => ['type' => 'INT', 'null' => true], + 'DisciplineID' => ['type' => 'int', 'null' => true], + 'DepartmentID' => ['type' => 'int', 'null' => true], + 'Formula' => ['type' => 'int', 'null' => true], + 'Unit1' => ['type' => 'varchar', 'constraint'=>20, 'null' => true], + 'Factor' => ['type' => 'int', 'null' => true], + 'Unit2' => ['type' => 'varchar', 'constraint'=>20, 'null' => true], + 'Decimal' => ['type' => 'int', 'null' => true], + 'CreateDate' => ['type' => 'Datetime', 'null' => true], + 'EndDate' => ['type' => 'Datetime', 'null' => true] + ]); + $this->forge->addKey('TestCalID', true); + $this->forge->createTable('testdefcal'); + + $this->forge->addField([ + 'TestGrpID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], + 'TestSiteID' => ['type' => 'INT', 'null' => true], + 'SiteID' => ['type' => 'INT', 'null' => true], + 'TestSiteCode' => ['type' => 'varchar', 'constraint'=> 6, 'null' => true], + 'TestSiteName' => ['type' => 'varchar', 'constraint'=> 50, 'null' => true], + 'Type' => ['type' => 'int', 'null' => true], + 'CreateDate' => ['type' => 'Datetime', 'null' => true], + 'EndDate' => ['type' => 'Datetime', 'null' => true] + ]); + $this->forge->addKey('TestGrpID', true); + $this->forge->createTable('testgrp'); + + $this->forge->addField([ + 'TestConsID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], + 'TestTechID' => ['type' => 'INT', 'null' => true], + 'ItemType' => ['type' => 'varchar', 'constraint'=>10,'null' => true], + 'ItemID' => ['type' => 'INT', 'null' => false], + 'ItemQty' => ['type' => 'varchar', 'constraint'=> 50, 'null' => true], + 'ItemUnit' => ['type' => 'varchar', 'constraint'=> 50, 'null' => true], + 'CreateDate' => ['type' => 'Datetime', 'null' => true], + 'EndDate' => ['type' => 'Datetime', 'null' => true] + ]); + $this->forge->addKey('TestConsID', true); + $this->forge->createTable('testdefconsumables'); + + } + + public function down() { + $this->forge->dropTable('testdef'); + $this->forge->dropTable('testdefsite'); + $this->forge->dropTable('testdeftech'); + $this->forge->dropTable('testdefcal'); + $this->forge->dropTable('testgrp'); + $this->forge->dropTable('testdefconsumables'); + } +} \ No newline at end of file From b856ff358d309da8f233737cc1811ee1979fa911 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Wed, 22 Oct 2025 13:30:43 +0700 Subject: [PATCH 2/2] add test mgt migration --- ...025-10-11-100001_Test_Management copy.php} | 44 ++++-------- .../2025-10-12-100001_Ref_Range.php | 69 +++++++++++++++++++ 2 files changed, 84 insertions(+), 29 deletions(-) rename app/Database/Migrations/{2025-10-11-100001_Test_Management.php => 2025-10-11-100001_Test_Management copy.php} (74%) create mode 100644 app/Database/Migrations/2025-10-12-100001_Ref_Range.php diff --git a/app/Database/Migrations/2025-10-11-100001_Test_Management.php b/app/Database/Migrations/2025-10-11-100001_Test_Management copy.php similarity index 74% rename from app/Database/Migrations/2025-10-11-100001_Test_Management.php rename to app/Database/Migrations/2025-10-11-100001_Test_Management copy.php index b487db9..eab0ac1 100644 --- a/app/Database/Migrations/2025-10-11-100001_Test_Management.php +++ b/app/Database/Migrations/2025-10-11-100001_Test_Management copy.php @@ -8,10 +8,11 @@ class CreateTestsTable extends Migration { public function up() { $this->forge->addField([ 'TestID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], - 'ParenTest' => ['type' => 'INT', 'null' => true], + 'ParentTest' => ['type' => 'INT', 'null' => true], 'TestCode' => ['type' => 'VARCHAR', 'constraint'=> 6, 'null' => false], 'TestName' => ['type' => 'varchar', 'constraint'=> 50, 'null' => false], 'Description' => ['type' => 'VARCHAR', 'constraint'=> 150, 'null' => false], + 'DisciplineID' => ['type' => 'INT', 'null' => false], 'Method' => ['type' => 'varchar', 'constraint'=>50, 'null' => true], 'Seq' => ['type' => 'int', 'constraint'=> 15, 'null' => true], 'CountStat' => ['type' => 'int' ], @@ -26,14 +27,14 @@ class CreateTestsTable extends Migration { 'SiteID' => ['type' => 'INT', 'null' => false], 'TestSiteCode' => ['type' => 'varchar', 'constraint'=> 6, 'null' => false], 'TestSiteName' => ['type' => 'varchar', 'constraint'=> 50, 'null' => false], - 'Type' => ['type' => 'int', 'null' => false], + 'Type' => ['type' => 'int', 'null' => false], 'Description' => ['type' => 'varchar', 'constraint'=> 150, 'null' => true], - 'SeqScr' => ['type' => 'int', 'null' => false], - 'SeqRpt' => ['type' => 'int', 'null' => false], - 'IndentLeft' => ['type' => 'int', 'null' => false], - 'VisibleScr' => ['type' => 'int', 'null' => false], - 'VisibleRpt' => ['type' => 'int', 'null' => false], - 'CountStat' => ['type' => 'int', 'null' => false], + 'SeqScr' => ['type' => 'int', 'null' => false], + 'SeqRpt' => ['type' => 'int', 'null' => false], + 'IndentLeft' => ['type' => 'int', 'null' => false], + 'VisibleScr' => ['type' => 'int', 'null' => false], + 'VisibleRpt' => ['type' => 'int', 'null' => false], + 'CountStat' => ['type' => 'int', 'null' => false], 'CreateDate' => ['type' => 'Datetime', 'null' => true], 'EndDate' => ['type' => 'Datetime', 'null' => true], ]); @@ -62,6 +63,7 @@ class CreateTestsTable extends Migration { 'TestTechAbb' => ['type' => 'varchar', 'constraint'=>50, 'null' => true], 'TestTechName' => ['type' => 'varchar', 'constraint'=>150, 'null' => true], 'Method' => ['type' => 'varchar', 'constraint'=>50, 'null' => true], + 'ExpectedTAT' => ['type' => 'INT', 'null' => true], 'CreateDate' => ['type' => 'Datetime', 'null' => true], 'EndDate' => ['type' => 'Datetime', 'null' => true] ]); @@ -72,9 +74,9 @@ class CreateTestsTable extends Migration { 'TestCalID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], 'SiteID' => ['type' => 'INT', 'null' => true], 'TestSiteID' => ['type' => 'INT', 'null' => true], - 'DisciplineID' => ['type' => 'int', 'null' => true], - 'DepartmentID' => ['type' => 'int', 'null' => true], - 'Formula' => ['type' => 'int', 'null' => true], + 'FormulaCode' => ['type' => 'varchar', 'constraint'=>150, 'null' => true], + 'FormulaLang' => ['type' => 'varchar', 'constraint'=>20, 'null' => true], + 'FormulaInput' => ['type' => 'varchar', 'constraint'=>20, 'null' => true], 'Unit1' => ['type' => 'varchar', 'constraint'=>20, 'null' => true], 'Factor' => ['type' => 'int', 'null' => true], 'Unit2' => ['type' => 'varchar', 'constraint'=>20, 'null' => true], @@ -87,30 +89,15 @@ class CreateTestsTable extends Migration { $this->forge->addField([ 'TestGrpID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], - 'TestSiteID' => ['type' => 'INT', 'null' => true], 'SiteID' => ['type' => 'INT', 'null' => true], - 'TestSiteCode' => ['type' => 'varchar', 'constraint'=> 6, 'null' => true], - 'TestSiteName' => ['type' => 'varchar', 'constraint'=> 50, 'null' => true], - 'Type' => ['type' => 'int', 'null' => true], + 'TestSiteID' => ['type' => 'INT', 'null' => true], + 'Member' => ['type' => 'INT', 'null' => true], 'CreateDate' => ['type' => 'Datetime', 'null' => true], 'EndDate' => ['type' => 'Datetime', 'null' => true] ]); $this->forge->addKey('TestGrpID', true); $this->forge->createTable('testgrp'); - $this->forge->addField([ - 'TestConsID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true], - 'TestTechID' => ['type' => 'INT', 'null' => true], - 'ItemType' => ['type' => 'varchar', 'constraint'=>10,'null' => true], - 'ItemID' => ['type' => 'INT', 'null' => false], - 'ItemQty' => ['type' => 'varchar', 'constraint'=> 50, 'null' => true], - 'ItemUnit' => ['type' => 'varchar', 'constraint'=> 50, 'null' => true], - 'CreateDate' => ['type' => 'Datetime', 'null' => true], - 'EndDate' => ['type' => 'Datetime', 'null' => true] - ]); - $this->forge->addKey('TestConsID', true); - $this->forge->createTable('testdefconsumables'); - } public function down() { @@ -119,6 +106,5 @@ class CreateTestsTable extends Migration { $this->forge->dropTable('testdeftech'); $this->forge->dropTable('testdefcal'); $this->forge->dropTable('testgrp'); - $this->forge->dropTable('testdefconsumables'); } } \ No newline at end of file diff --git a/app/Database/Migrations/2025-10-12-100001_Ref_Range.php b/app/Database/Migrations/2025-10-12-100001_Ref_Range.php new file mode 100644 index 0000000..6818568 --- /dev/null +++ b/app/Database/Migrations/2025-10-12-100001_Ref_Range.php @@ -0,0 +1,69 @@ +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'); + } +} \ No newline at end of file