 
 
 --
--- Name: _RETURN; Type: RULE; Schema: public; Owner: -
---
-
-CREATE RULE "_RETURN" AS
-    ON SELECT TO api_distributions_view DO INSTEAD  SELECT d.id,
-    d.taxon_concept_id,
-    g.name_en,
-    g.name_es,
-    g.name_fr,
-    g.iso_code2,
-    gt.name AS geo_entity_type,
-    array_agg_notnull(tags.name ORDER BY tags.name) AS tags,
-    array_agg_notnull(r.citation ORDER BY r.citation) AS citations,
-    d.created_at,
-    d.updated_at
-   FROM ((((((distributions d
-     JOIN geo_entities g ON ((g.id = d.geo_entity_id)))
-     JOIN geo_entity_types gt ON ((gt.id = g.geo_entity_type_id)))
-     LEFT JOIN taggings ON ((((taggings.taggable_type)::text = 'Distribution'::text) AND (taggings.taggable_id = d.id))))
-     LEFT JOIN tags ON ((tags.id = taggings.tag_id)))
-     LEFT JOIN distribution_references dr ON ((dr.distribution_id = d.id)))
-     LEFT JOIN "references" r ON ((r.id = dr.reference_id)))
-  GROUP BY d.id, g.name_en, g.name_es, g.name_fr, g.iso_code2, gt.name;
-
-
---
 -- Name: ahoy_events_user_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
 --
 


INSERT INTO schema_migrations (version) VALUES ('20141004214703');

INSERT INTO schema_migrations (version) VALUES ('20141014125738');

INSERT INTO schema_migrations (version) VALUES ('20141119154955');

INSERT INTO schema_migrations (version) VALUES ('20141124163355');

INSERT INTO schema_migrations (version) VALUES ('20141128154019');

INSERT INTO schema_migrations (version) VALUES ('20141202120154');

INSERT INTO schema_migrations (version) VALUES ('20141202142048');

INSERT INTO schema_migrations (version) VALUES ('20141209092341');

INSERT INTO schema_migrations (version) VALUES ('20141209133037');

INSERT INTO schema_migrations (version) VALUES ('20141215104216');

INSERT INTO schema_migrations (version) VALUES ('20141215114029');


--

ALTER SEQUENCE events_id_seq OWNED BY events.id;


--
