From 15907db94d0e58cfe11682d295ae4f20f3a7ef8f Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Wed, 16 Oct 2013 18:17:37 +0200 Subject: [PATCH] MT#4461 create a default-system contact for reseller and peering contracts --- db_scripts/diff/15027.up | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db_scripts/diff/15027.up diff --git a/db_scripts/diff/15027.up b/db_scripts/diff/15027.up new file mode 100644 index 00000000..80a6eb09 --- /dev/null +++ b/db_scripts/diff/15027.up @@ -0,0 +1,11 @@ +USE billing; + +INSERT INTO contacts(email) VALUES('default-system@default.invalid'); +SELECT LAST_INSERT_ID() INTO @cid; + +UPDATE contracts ctr, billing_mappings m, products p, contacts c SET ctr.contact_id = @cid +WHERE c.id = ctr.contact_id + AND m.contract_id = ctr.id + AND m.product_id = p.id + AND p.class IN ('pstnpeering', 'sippeering', 'reseller') + AND c.reseller_id IS NOT NULL;