Merge branch 'sync-generate-zonefile-sql-with-master' into registry-475-refactor-zones

# Conflicts:
#	db/schema-read-only.rb
#	db/structure.sql
This commit is contained in:
Artur Beljajev 2017-04-22 17:01:06 +03:00
commit cc387d9675
3 changed files with 133 additions and 7 deletions

View file

@ -167,7 +167,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
exclude_filter varchar := '';
tmp_var text;
ret text;
BEGIN
BEGIN
-- define filters
include_filter = '%.' || i_origin;
@ -203,7 +203,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
-- ns records
SELECT array_to_string(
array(
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
SELECT concat(d.name_puny, '. IN NS ', coalesce(ns.hostname_puny, ns.hostname), '.')
FROM domains d
JOIN nameservers ns ON ns.domain_id = d.id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
@ -222,7 +222,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
-- a glue records for other nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN A ', unnest(ns.ipv4))
SELECT concat(coalesce(ns.hostname_puny, ns.hostname), '. IN A ', unnest(ns.ipv4))
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
@ -242,7 +242,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
-- aaaa glue records for other nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN AAAA ', unnest(ns.ipv6))
SELECT concat(coalesce(ns.hostname_puny, ns.hostname), '. IN AAAA ', unnest(ns.ipv6))
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
@ -2930,7 +2930,7 @@ ALTER SEQUENCE whois_records_id_seq OWNED BY whois_records.id;
--
-- Name: zones; Type: TABLE; Schema: public; Owner: -; Tablespace:
-- Name: zones; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE zones (
@ -3985,7 +3985,7 @@ ALTER TABLE ONLY whois_records
--
-- Name: zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
-- Name: zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY zones
@ -5217,3 +5217,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170419120048');
INSERT INTO schema_migrations (version) VALUES ('20170420125200');
INSERT INTO schema_migrations (version) VALUES ('20170422130054');