<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddConstraintOnEmployeePayInfo extends Migration
{
    public function up()
    {
        $this->forge->addForeignKey('employee_id', 'employee', 'employee_id', 'CASCADE', 'RESTRICT');
        $this->forge->addForeignKey('paytype_id', 'pay_type', 'paytype_id', 'CASCADE', 'RESTRICT');
        $this->forge->processIndexes('emp_pay_info');
    }

    public function down()
    {
        $this->forge->dropForeignKey('emp_pay_info', 'emp_pay_info_employee_id_foreign');
        $this->forge->dropForeignKey('emp_pay_info', 'emp_pay_info_paytype_id_foreign');
        $this->forge->processIndexes('emp_pay_info');
    }
}
