add CRM Zones Org

This commit is contained in:
mahdahar 2025-10-24 11:19:58 +07:00
parent a71a587573
commit bc8653d89f
3 changed files with 102 additions and 1 deletions

View File

@ -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([

View File

@ -0,0 +1,37 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateCRMOrgTable extends Migration {
public function up() {
$this->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');
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Organization extends Migration {
public function up() {
$this->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);
}
}