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, ], 'branch_code' => [ 'type' => 'VARCHAR', 'constraint' => 25, 'null' => false, 'after' => 'company_id', ], 'dept_id' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, ], 'job_title_id' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, ], 'pay_group_id' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => false, ], '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 ], 'actual_work_days' => [ 'type' => 'DECIMAL', 'constraint' => '12,4', 'null' => false ], 'basic_pay' => [ 'type' => 'DECIMAL', 'constraint' => '12,4', '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('paytrans_id', 'pay_trans', 'paytrans_id', 'CASCADE', 'RESTRICT'); $this->forge->addForeignKey('company_id', 'company_info', 'company_id', 'CASCADE', 'RESTRICT'); $this->forge->addForeignKey('branch_code', 'company_branch', 'branch_code', 'CASCADE', 'RESTRICT'); $this->forge->addForeignKey('dept_id', 'company_dept', 'dept_id', 'CASCADE', 'RESTRICT'); $this->forge->addForeignKey('job_title_id', 'job_title', 'job_title_id', 'CASCADE', 'RESTRICT'); $this->forge->addForeignKey('pay_group_id', 'pay_group', 'pay_group_id', 'CASCADE', 'RESTRICT'); $this->forge->addForeignKey('emp_status_id', 'emp_status', 'emp_status_id', 'CASCADE', 'RESTRICT'); $this->forge->addForeignKey('employee_id', 'employee', 'employee_id', 'CASCADE', 'RESTRICT'); $this->forge->createTable('emp_pay_trans'); } public function down() { $this->forge->dropTable('emp_pay_trans'); } }