Last active
April 8, 2017 02:37
-
-
Save hannesbe/5fa053d4323bddd4f248c723fd416417 to your computer and use it in GitHub Desktop.
SQL snippets to bulk update records & soa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Update SOA records for zones having a certain IP in the content */ | |
UPDATE records | |
SET `content` = 'ns1.connexeon.com. domains.connexeon.com. 2017040701 1200 400 1209600 300' | |
WHERE `id` IN | |
(SELECT `id` | |
FROM records_copy | |
WHERE `type`='SOA' | |
AND `domain_id` IN | |
(SELECT DISTINCT `domain_id` | |
FROM records_copy | |
WHERE `content` = '85.158.108.156' | |
AND `type`='A') ); | |
/* Update A records */ | |
UPDATE records | |
SET `content` = '37.97.167.93' | |
WHERE `content` = '85.158.108.156' | |
AND `type`='A'; | |
/* Updating SOA records with an expected serial */ | |
UPDATE records | |
SET `content` = 'ns1.connexeon.com. domains.connexeon.com. 2017040702 1200 400 1209600 300' | |
WHERE `content` = 'ns1.connexeon.com. domains.connexeon.com. 2017040701 1200 400 1209600 300' | |
AND `type`='SOA'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment