You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kwpayroll/app/Database/Migrations/2024-09-11-081707_AddPayGrp...

35 lines
961 B
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddPayGrpOnEmployee extends Migration
{
public function up()
{
$fields = [
'pay_group_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => false,
'default' => 0, // Remove this if you want to recreate Employee migration
'after' => 'emp_status_id',
],
];
$this->forge->addColumn('employee', $fields);
$this->forge->addForeignKey('pay_group_id', 'pay_group', 'pay_group_id', 'CASCADE', 'RESTRICT');
$this->forge->processIndexes('employee');
}
public function down()
{
$this->forge->dropForeignKey('employee', 'employee_pay_group_id_foreign');
$this->forge->processIndexes('employee');
$this->forge->dropColumn('employee', 'pay_group_id');
}
}