summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-06-12 15:13:11 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-06-12 15:13:11 +0100
commit963185b554f8d5f1ab987359c89726f4fe606cbb (patch)
tree9299dba97c0219c3ad9e121801c8ae0b84c4fdeb
parentFix changelogfts type in comment (diff)
downloadgentoobrowse-api-963185b554f8d5f1ab987359c89726f4fe606cbb.tar.bz2
gentoobrowse-api-963185b554f8d5f1ab987359c89726f4fe606cbb.tar.xz
gentoobrowse-api-963185b554f8d5f1ab987359c89726f4fe606cbb.zip
Index changelog by package
-rw-r--r--gentoobrowse-api/db/schema.sql13
1 files changed, 13 insertions, 0 deletions
diff --git a/gentoobrowse-api/db/schema.sql b/gentoobrowse-api/db/schema.sql
index dfe6f42..4a90665 100644
--- a/gentoobrowse-api/db/schema.sql
+++ b/gentoobrowse-api/db/schema.sql
@@ -52,6 +52,17 @@ CREATE TABLE bugs (
ALTER TABLE bugs OWNER TO gentoo;
-- Name: TABLE bugs; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo
COMMENT ON TABLE bugs IS 'Import of Gentoo Bugs bug list from snapshots';
+-- Name: changelogpackages(changelog); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo
+CREATE FUNCTION changelogpackages(cl changelog) RETURNS text[]
+ LANGUAGE plpgsql IMMUTABLE
+ AS $$
+BEGIN
+ RETURN (SELECT ARRAY_AGG(split_part(file, '/', 1) || '/' || split_part(file, '/', 2))
+ FROM UNNEST(cl.files) file
+ WHERE split_part(file, '/', 3) LIKE '%.ebuild');
+END
+$$;
+ALTER FUNCTION gentoobrowse.changelogpackages(cl changelog) OWNER TO gentoo;
-- Name: changelogfts(changelog); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo
CREATE FUNCTION changelogfts(cl changelog) RETURNS tsvector
LANGUAGE plpgsql IMMUTABLE
@@ -742,6 +753,8 @@ ALTER TABLE use_local CLUSTER ON use_local_pkey;
CREATE INDEX idx_changelog_committime ON changelog USING btree (committime);
-- Name: idx_changelog_fts; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace:
CREATE INDEX idx_changelog_fts ON changelog USING gin (changelogfts(changelog.*));
+-- Name: idx_changelog_packages; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace:
+CREATE INDEX idx_changelog_packages ON changelog USING gin (changelogpackages(changelog.*));
-- Name: idx_bug_fts; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace:
CREATE INDEX idx_bug_fts ON bugs USING gin (bugfts(bugs.*));
-- Name: idx_bugs_firstseen; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: