initial project
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateStaffDetails extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField([
|
||||
'staff_id' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
|
||||
'employee_name' => ['type' => 'VARCHAR', 'constraint' => 255],
|
||||
'email' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'phone_no' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true],
|
||||
'bank_name' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'bank_acc_no' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'resign_date' => ['type' => 'DATE', 'null' => true],
|
||||
'position_id' => ['type' => 'INT', 'unsigned' => true],
|
||||
'username' => ['type' => 'VARCHAR', 'constraint' => 100],
|
||||
'password' => ['type' => 'VARCHAR', 'constraint' => 255],
|
||||
'branch_id' => ['type' => 'INT', 'unsigned' => true],
|
||||
'created_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
'updated_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
'deleted_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('staff_id', true);
|
||||
$this->forge->addForeignKey('position_id', 'position', 'position_id', 'CASCADE', 'CASCADE');
|
||||
$this->forge->addForeignKey('branch_id', 'branch_details', 'branch_id', 'CASCADE', 'CASCADE');
|
||||
$this->forge->createTable('staff_details');
|
||||
}
|
||||
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable('staff_details');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user