clqms-be/app/Database/Migrations/2026-01-01-000021_CreateOrders.php
OpenCode Bot 9946978487 chore: refresh CLQMS backend baseline
Re-synced controllers, configs, libraries, seeds, and docs with the latest API expectations and response helpers.
2026-04-08 16:07:19 +07:00

73 lines
3.2 KiB
PHP
Executable File

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateOrders extends Migration {
public function up() {
$this->forge->addField([
'InternalOID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
'OrderID' => ['type' => 'VARCHAR', 'constraint'=> 22, 'null' => false],
'PlacerID' => ['type' => 'VARCHAR', 'constraint'=> 22, 'null' => true],
'InternalPID' => ['type' => 'INT', 'null' => false],
'SiteID' => ['type' => 'VARCHAR', 'constraint'=> 15, 'null' => false],
'PVADTID' => ['type' => 'INT', 'null' => false],
'ReqApp' => ['type' => 'VARCHAR', 'constraint'=> 15, 'null' => true],
'Priority' => ['type' => 'VARCHAR', 'constraint' => 10, 'null' => true],
'TrnDate' => ['type' => 'Datetime', 'null' => true],
'EffDate' => ['type' => 'Datetime', 'null' => true],
'CreateDate' => ['type' => 'Datetime', 'null' => true],
'EndDate' => ['type' => 'Datetime', 'null' => true],
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
'DelDate' => ['type' => 'Datetime', 'null' => true]
]);
$this->forge->addKey('InternalOID', true);
$this->forge->addUniqueKey('OrderID');
$this->forge->createTable('ordertest');
$this->forge->addField([
'OrderComID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
'InternalOID' => ['type' => 'INT', 'null' => false],
'Comment' => ['type' => 'text', 'null' => true],
'CreateDate' => ['type' => 'Datetime', 'null' => true],
'EndDate' => ['type' => 'Datetime', 'null' => true],
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
'DelDate' => ['type' => 'Datetime', 'null' => true]
]);
$this->forge->addKey('OrderComID', true);
$this->forge->createTable('ordercom');
$this->forge->addField([
'OrderAttID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
'InternalOID' => ['type' => 'INT', 'null' => false],
'Address' => ['type' => 'varchar', 'constraint'=>255, 'null' => true],
'CreateDate' => ['type' => 'Datetime', 'null' => true],
'EndDate' => ['type' => 'Datetime', 'null' => true],
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
'DelDate' => ['type' => 'Datetime', 'null' => true]
]);
$this->forge->addKey('OrderAttID', true);
$this->forge->createTable('orderatt');
$this->forge->addField([
'OrderStatID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
'InternalOID' => ['type' => 'INT', 'null' => false],
'OrderStatus' => ['type' => 'VARCHAR', 'constraint' => 10, 'null' => false],
'CreateDate' => ['type' => 'Datetime', 'null' => true],
'EndDate' => ['type' => 'Datetime', 'null' => true],
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
'DelDate' => ['type' => 'Datetime', 'null' => true]
]);
$this->forge->addKey('OrderStatID', true);
$this->forge->createTable('orderstatus');
}
public function down() {
$this->forge->dropTable('orderstatus');
$this->forge->dropTable('orderatt');
$this->forge->dropTable('ordercom');
$this->forge->dropTable('ordertest');
}
}