From 6c0394aea3700b7496b30f51af9a6f9bcb69c743 Mon Sep 17 00:00:00 2001 From: "sas.fajri" Date: Sun, 31 May 2026 14:32:54 +0700 Subject: [PATCH] FHM31052601IBL - migration script enkripsi t_orderdelivery destination Co-Authored-By: Claude Sonnet 4.6 --- scripts/migrate_encrypt_orderdelivery.php | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 scripts/migrate_encrypt_orderdelivery.php diff --git a/scripts/migrate_encrypt_orderdelivery.php b/scripts/migrate_encrypt_orderdelivery.php new file mode 100644 index 00000000..c3d2cf7a --- /dev/null +++ b/scripts/migrate_encrypt_orderdelivery.php @@ -0,0 +1,57 @@ + PDO::ERRMODE_EXCEPTION] +); + +echo "=== Migrasi t_orderdelivery ===\n"; +$total = 0; +$stmt = $pdo->prepare( + "UPDATE t_orderdelivery SET T_OrderDeliveryDestination_enc = ? WHERE T_OrderDeliveryID = ?" +); + +while (true) { + $rows = $pdo->query( + "SELECT T_OrderDeliveryID, T_OrderDeliveryDestination + FROM t_orderdelivery + WHERE T_OrderDeliveryDestination_enc IS NULL + LIMIT 500" + )->fetchAll(PDO::FETCH_ASSOC); + + if (empty($rows)) break; + + foreach ($rows as $row) { + $stmt->execute([ + $enc->encrypt((string)($row['T_OrderDeliveryDestination'] ?? '')), + $row['T_OrderDeliveryID'], + ]); + $total++; + } + echo " {$total} rows...\n"; +} + +echo "t_orderdelivery selesai: {$total} rows\n";