From 7fc076ac1492a8dd15385731878c9f201dc27d32 Mon Sep 17 00:00:00 2001 From: Nacho Date: Mon, 29 Jul 2024 13:45:30 +0200 Subject: [PATCH] Anonymize iban account number --- .gitignore | 1 + lib/pgsync/task.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 9fe0d8b1..e4a68542 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /spec/reports/ /tmp/ /.pgsync.yml +/.idea diff --git a/lib/pgsync/task.rb b/lib/pgsync/task.rb index 1cdceb7c..e926205d 100644 --- a/lib/pgsync/task.rb +++ b/lib/pgsync/task.rb @@ -265,6 +265,8 @@ def apply_strategy(rule, table, column, primary_key) when "random_letter" # casting double to int rounds "chr(65 + (RANDOM() * 25)::int)" + when "anonymize_iban_account_number" + "regexp_replace(#{table}.#{column}, '.{10}$', lpad(#{quoted_primary_key(table, primary_key, rule)}::text, 10, '0'))" when "random_string" "RIGHT(MD5(RANDOM()::text), 10)" when "null", nil