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-10-04-072909_CreateEmp...

194 lines
5.5 KiB
PHTML

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateEmpPayTrans extends Migration
{
public function up()
{
$this->forge->addField([
'emppaytrans_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true
],
'paytrans_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'company_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'dept_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'job_title_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'emp_status_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'employee_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true
],
'company_issued_id' => [
'type' => 'VARCHAR',
'constraint' => 25,
],
'last_name' => [
'type' => 'VARCHAR',
'constraint' => 255,
],
'first_name' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
'middle_name' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
'suffix' => [
'type' => 'VARCHAR',
'constraint' => 10,
'null' => true,
],
'email_address' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
'is_ATM' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'savings_account' => [
'type' => 'VARCHAR',
'constraint' => 50,
'null' => true
],
'basic_monthly_pay' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'basic_daily_pay' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'basic_hourly_pay' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'has_cola' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'has_philhealth' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'has_hdmf' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'has_sss' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'has_gsis' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'gross_income' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'taxable_income' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'nontaxable_income' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'income_tax' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'total_deduction' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'net_pay' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'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('emppaytrans_id', true);
$this->forge->addForeignKey('paytype_id', 'pay_type', 'paytype_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('payschedule_id', 'pay_schedule', 'payschedule_id', 'CASCADE', 'RESTRICT');
$this->forge->createTable('pay_trans');
}
public function down()
{
//
}
}