From bc8653d89f5b0876054e1c26f1d4ec96ffe5d79b Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Fri, 24 Oct 2025 11:19:58 +0700 Subject: [PATCH] add CRM Zones Org --- ...RM.php => 2025-10-22-100001_CRM_Zones.php} | 2 +- .../2025-10-23-100001_CRM_Organizations.php | 37 +++++++++++ .../2025-10-23-110105_Organization.php | 64 +++++++++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) rename app/Database/Migrations/{2025-10-22-100001_Zones_CRM.php => 2025-10-22-100001_CRM_Zones.php} (94%) create mode 100644 app/Database/Migrations/2025-10-23-100001_CRM_Organizations.php create mode 100644 app/Database/Migrations/2025-10-23-110105_Organization.php diff --git a/app/Database/Migrations/2025-10-22-100001_Zones_CRM.php b/app/Database/Migrations/2025-10-22-100001_CRM_Zones.php similarity index 94% rename from app/Database/Migrations/2025-10-22-100001_Zones_CRM.php rename to app/Database/Migrations/2025-10-22-100001_CRM_Zones.php index 051d1f3..7029497 100644 --- a/app/Database/Migrations/2025-10-22-100001_Zones_CRM.php +++ b/app/Database/Migrations/2025-10-22-100001_CRM_Zones.php @@ -4,7 +4,7 @@ namespace App\Database\Migrations; use CodeIgniter\Database\Migration; -class CreateZonessTable extends Migration { +class CreateZonesTable extends Migration { public function up() { $this->forge->addField([ diff --git a/app/Database/Migrations/2025-10-23-100001_CRM_Organizations.php b/app/Database/Migrations/2025-10-23-100001_CRM_Organizations.php new file mode 100644 index 0000000..a0d167e --- /dev/null +++ b/app/Database/Migrations/2025-10-23-100001_CRM_Organizations.php @@ -0,0 +1,37 @@ +forge->addField([ + 'accountid' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true], + 'parrentaccount' => ['type' => 'INT', 'null' => true], + 'accountname' => ['type' => 'VARCHAR', 'constraint' => 10, 'null' => false], + 'accountnpwp' => ['type' => 'VARCHAR', 'constraint' => 5, 'null' => false], + 'inital' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => false], + 'street_1' => ['type' => 'VARCHAR', 'constraint' => 150, 'null' => true], + 'street_2' => ['type' => 'VARCHAR', 'constraint' => 150, 'null' => true], + 'street_3' => ['type' => 'VARCHAR', 'constraint' => 150, 'null' => true], + 'zoneid' => ['type' => 'int', 'null' => true], + 'zip' => ['type' => 'VARCHAR', 'constraint' => 10, 'null' => true], + 'country' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], + 'email_1' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], + 'email_2' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], + 'phone' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], + 'fax' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], + 'createdate' => ['type' => 'datetime', 'null'=> true], + 'enddate' => ['type' => 'datetime', 'null'=> true] + ]); + + $this->forge->addKey('accountid', true); + $this->forge->createTable('accounts'); + } + + public function down() { + $this->forge->dropTable('accounts'); + } +} \ No newline at end of file diff --git a/app/Database/Migrations/2025-10-23-110105_Organization.php b/app/Database/Migrations/2025-10-23-110105_Organization.php new file mode 100644 index 0000000..9ed53e0 --- /dev/null +++ b/app/Database/Migrations/2025-10-23-110105_Organization.php @@ -0,0 +1,64 @@ +forge->addField([ + 'DisciplineID' => ['type' => 'int', 'unsigned' => true, 'auto_increment'=> true], + 'DisciplineCode' => ['type' => 'varchar', 'constraint'=> 10, 'null'=> false], + 'DisciplineName' => ['type' => 'varchar', 'constraint'=> 150, 'null'=> true], + 'CreateDate' => ['type'=>'DATETIME', 'null' => true], + 'EndDate' => ['type'=>'DATETIME', 'null' => true] + ]); + $this->forge->addKey('DiciplineID', true); + $this->forge->createTable('discipline'); + + $this->forge->addField([ + 'DepartmentID' => ['type' => 'int', 'unsigned' => true, 'auto_increment'=> true], + 'DisciplineID' => ['type' => 'int', 'null'=> false], + 'SiteID' => ['type' => 'int', 'null'=> false], + 'DepartmentCode' => ['type' => 'varchar', 'constraint'=>10, 'null'=> false], + 'DepartmentName' => ['type' => 'varchar', 'constraint'=> 150, 'null'=> true], + 'CreateDate' => ['type'=>'DATETIME', 'null' => true], + 'EndDate' => ['type'=>'DATETIME', 'null' => true] + ]); + $this->forge->addKey('DepartmentID', true); + $this->forge->createTable('department'); + + $this->forge->addField([ + 'WorkstationID' => ['type' => 'int', 'unsigned' => true, 'auto_increment'=> true], + 'DepartmentID' => ['type' => 'int', 'null'=> false], + 'WorkstationCode' => ['type' => 'varchar', 'constraint'=>10, 'null'=> false], + 'WorkstationName' => ['type' => 'varchar', 'constraint'=> 150, 'null'=> true], + 'Type' => ['type' => 'tinyint', 'null'=> true], + 'LinkTo' => ['type' => 'int', 'null'=> true], + 'Enable' => ['type' => 'bit', 'null'=> true], + 'EquipmentID' => ['type' => 'varchar', 'constraint'=>'10', 'null'=> true], + 'CreateDate' => ['type'=>'DATETIME', 'null' => true], + 'EndDate' => ['type'=>'DATETIME', 'null' => true] + ]); + $this->forge->addKey('WorkstationID', true); + $this->forge->createTable('workstation'); + + $this->forge->addField([ + 'WorkbenchID' => ['type' => 'int', 'unsigned' => true, 'auto_increment'=> true], + 'DepartmentID' => ['type' => 'int', 'null'=> false], + 'WorkbenchCode' => ['type' => 'varchar', 'constraint'=>10, 'null'=> false], + 'WorkbenchName' => ['type' => 'varchar', 'constraint'=> 150, 'null'=> true], + 'CreateDate' => ['type'=>'DATETIME', 'null' => true], + 'EndDate' => ['type'=>'DATETIME', 'null' => true] + ]); + $this->forge->addKey('WorkbenchID', true); + $this->forge->createTable('workbench'); + } + + public function down() { + $this->forge->dropTable('discipline', true); + $this->forge->dropTable('department', true); + $this->forge->dropTable('workstation', true); + $this->forge->dropTable('workbench', true); + } +}