Running PowerDNS with MySQL backend and forgot to add SPF records to each domain?
INSERT INTO `pdns`.`records`
(`id`, `domain_id`, `name`, `type`, `content`, `ttl`, `prio`,
`change_date`, `ordername`, `disabled`, `auth`, `comments`,
`created`, `last_change`)
SELECT
NULL, id, name, 'TXT', '"v=spf1 mx a ptr -all"', '3600', NULL,
NULL, NULL, '0', '1', '', CURRENT_TIMESTAMP, '0000-00-00 00:00:00.000000'
FROM
domains
WHERE
id NOT IN (
SELECT
domain_id
FROM
records
WHERE
content LIKE
'%spf%'
AND
TYPE = 'TXT'
ORDER BY
`domain_id` ASC
)
While you are add it, lets do some cleaning!
UPDATE domains SET name = LOWER(name);
UPDATE records SET name = LOWER(name);
UPDATE records SET content = LOWER(content) where type = 'cname';
UPDATE records SET content = LOWER(content) where type = 'mx';