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-20-165644_CreateEmp...

86 lines
2.3 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateEmpPayIncomeDeduction extends Migration
{
public function up()
{
$this->forge->addField([
'emppayinded_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true
],
'emppay_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'inded_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'is_fixed_amt' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'is_percent_amt' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'amount' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'is_override' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
// Common fields
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'created_by' => [
'type' => 'VARCHAR',
'constraint' => '20',
'null' => true
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_by' => [
'type' => 'VARCHAR',
'constraint' => '20',
'null' => true
],
'deleted_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('emppayinded_id', true);
$this->forge->addForeignKey('emppay_id', 'emp_pay_info', 'emppay_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('inded_id', 'pay_income_deduction', 'inded_id', 'CASCADE', 'RESTRICT');
$this->forge->createTable('emp_pay_inded');
}
public function down()
{
$this->forge->dropTable('emp_pay_inded');
}
}