nhance/app/Database/Migrations/2026-07-28-090700_CreateClaimReportTable.php
2026-07-28 15:52:47 +05:30

208 lines
6.3 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateClaimReportTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'BIGINT',
'unsigned' => true,
'auto_increment' => true,
],
'tpa_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => true,
],
'client_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => true,
],
'client_policy_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => false,
],
'file_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => true,
],
'ticket_id' => [
'type' => 'BIGINT',
'unsigned' => true,
'null' => true,
],
'source_table' => [
'type' => 'VARCHAR',
'constraint' => 64,
'null' => true,
],
'source_row_id' => [
'type' => 'BIGINT',
'unsigned' => true,
'null' => true,
],
'claim_number' => [
'type' => 'VARCHAR',
'constraint' => 191,
'null' => false,
],
'emp_code' => [
'type' => 'VARCHAR',
'constraint' => 100,
'null' => true,
],
'tpa_no' => [
'type' => 'VARCHAR',
'constraint' => 100,
'null' => true,
],
'emp_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => true,
],
'insured_emp_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => true,
],
'claim_amount' => [
'type' => 'VARCHAR',
'constraint' => 50,
'null' => true,
],
'approved_amount' => [
'type' => 'VARCHAR',
'constraint' => 50,
'null' => true,
],
'incurred_amount' => [
'type' => 'VARCHAR',
'constraint' => 50,
'null' => true,
],
'si_amt' => [
'type' => 'VARCHAR',
'constraint' => 50,
'null' => true,
],
'tpa_claim_status' => [
'type' => 'VARCHAR',
'constraint' => 191,
'null' => true,
],
'claim_status_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => true,
],
'tpa_claim_type' => [
'type' => 'VARCHAR',
'constraint' => 100,
'null' => true,
],
'tpa_ailments' => [
'type' => 'TEXT',
'null' => true,
],
'doa' => [
'type' => 'DATE',
'null' => true,
],
'dod' => [
'type' => 'DATE',
'null' => true,
],
'date_of_intimat' => [
'type' => 'DATE',
'null' => true,
],
'settled_date' => [
'type' => 'DATE',
'null' => true,
],
'approved_date' => [
'type' => 'DATE',
'null' => true,
],
'claim_dump_date' => [
'type' => 'DATETIME',
'null' => true,
],
'hospital_name' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
'hospital_city' => [
'type' => 'VARCHAR',
'constraint' => 150,
'null' => true,
],
'hospital_state' => [
'type' => 'VARCHAR',
'constraint' => 150,
'null' => true,
],
'hospital_pin_code' => [
'type' => 'VARCHAR',
'constraint' => 20,
'null' => true,
],
'hospital_address' => [
'type' => 'TEXT',
'null' => true,
],
'gender' => [
'type' => 'VARCHAR',
'constraint' => 30,
'null' => true,
],
'age' => [
'type' => 'VARCHAR',
'constraint' => 20,
'null' => true,
],
'relation' => [
'type' => 'VARCHAR',
'constraint' => 50,
'null' => true,
],
'is_active' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 1,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->addUniqueKey(['client_policy_id', 'claim_number'], 'uq_claim_report_policy_claim');
$this->forge->addKey(['client_policy_id', 'is_active'], false, false, 'idx_claim_report_policy_active');
$this->forge->addKey('ticket_id', false, false, 'idx_claim_report_ticket');
$this->forge->addKey(['source_table', 'source_row_id'], false, false, 'idx_claim_report_source');
$this->forge->createTable('claim_report', true);
}
public function down()
{
$this->forge->dropTable('claim_report', true);
}
}