From f120638741ce4e911eed398a5666d123b075d7ba Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Fri, 17 Nov 2023 09:54:53 +0100 Subject: [PATCH] phone number migration OP-1464 --- ...20231112161533-update-phone-numbers.sparql | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 config/migrations/2023/20231112161533-update-phone-numbers.sparql diff --git a/config/migrations/2023/20231112161533-update-phone-numbers.sparql b/config/migrations/2023/20231112161533-update-phone-numbers.sparql new file mode 100644 index 0000000..61556c9 --- /dev/null +++ b/config/migrations/2023/20231112161533-update-phone-numbers.sparql @@ -0,0 +1,38 @@ +DELETE { + ?s ?o . +} +INSERT { + GRAPH { + ?s ?newPhoneNumber . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER (SUBSTR(?o, 1, 1) != "+" AND STRLEN(STR(?o)) > 4) + BIND(REPLACE(STR(?o),"[. - /]","") AS ?removedSpaces) . + BIND (CONCAT('tel:+32', SUBSTR(?removedSpaces, 2)) as ?newPhoneNumber) +} + +DELETE { + ?s ?o . +} +INSERT { + GRAPH { + ?s ?newPhoneNumber . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER (SUBSTR(?o, 1, 1) = "+") + BIND(REPLACE(STR(?o),"[. - /]","") AS ?removedSpaces) . + BIND (CONCAT('tel:', ?removedSpaces, 2) as ?newPhoneNumber) +} + + +