devsofttech_hms_ci4/app/Database/Migrations/2026-09-09-000003_CreateAbdmLinkTransactions.php
DevSoftTech Server 9176877d07 feat(abdm): implement M1 find ABHA by mobile flow & M2 user-initiated linking
- M1: Update Find ABHA via Mobile to compliance flow: Mobile Number -> Profiles -> OTP -> Complete Profile Fetched
- M2: Support walk-in non-ABHA patient discovery via demographic matching (verified mobile, gender, year of birth, name)
- M2: Implement care context linking endpoints (/records/link/init and /records/link/confirm) with OTP verification
- Add abdm_link_transactions database migration
- Support Bearer token and HMAC signature authentication for bridge callbacks over VPN
2026-09-09 17:52:20 +05:30

85 lines
2.4 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateAbdmLinkTransactions extends Migration
{
public function up(): void
{
if ($this->db->tableExists('abdm_link_transactions')) {
return;
}
$this->forge->addField([
'id' => [
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => true,
'auto_increment' => true,
],
'txn_id' => [
'type' => 'VARCHAR',
'constraint' => 120,
'null' => false,
],
'patient_id' => [
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => true,
'null' => false,
],
'patient_ref' => [
'type' => 'VARCHAR',
'constraint' => 80,
'null' => true,
],
'abha_address' => [
'type' => 'VARCHAR',
'constraint' => 120,
'null' => false,
],
'otp' => [
'type' => 'VARCHAR',
'constraint' => 120,
'null' => false,
],
'care_contexts' => [
'type' => 'TEXT',
'null' => true,
],
'status' => [
'type' => 'VARCHAR',
'constraint' => 30,
'default' => 'INITIATED',
'null' => false,
],
'expires_at' => [
'type' => 'DATETIME',
'null' => false,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->addKey('txn_id');
$this->forge->addKey('patient_id');
$this->forge->addKey('abha_address');
$this->forge->addKey('status');
$this->forge->createTable('abdm_link_transactions', true);
}
public function down(): void
{
$this->forge->dropTable('abdm_link_transactions', true);
}
}