initial project
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateCustomerDetails extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField([
|
||||
'customer_id' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
|
||||
'company_name' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'company_ssm_no' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => true],
|
||||
'DOB' => ['type' => 'DATE', 'null' => true],
|
||||
'TIN_no' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => true],
|
||||
'phone_no' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true],
|
||||
'email' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'address_1' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'address_2' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'address_3' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'address_4' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'poscode' => ['type' => 'VARCHAR', 'constraint' => 10, 'null' => true],
|
||||
'town' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => true],
|
||||
'state' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => true],
|
||||
'country' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => true],
|
||||
'membership_no' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => true],
|
||||
'platform_id' => ['type' => 'INT', 'unsigned' => true, 'null' => true],
|
||||
'membership_expiry' => ['type' => 'DATE', 'null' => true],
|
||||
'created_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
'updated_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
'deleted_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('customer_id', true);
|
||||
$this->forge->addForeignKey('platform_id', 'platform', 'platform_id', 'SET NULL', 'CASCADE');
|
||||
$this->forge->createTable('customer_details');
|
||||
}
|
||||
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable('customer_details');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user