summaryrefslogtreecommitdiff
path: root/gentoobrowse/datasources/schema.sql
diff options
context:
space:
mode:
Diffstat (limited to 'gentoobrowse/datasources/schema.sql')
-rw-r--r--gentoobrowse/datasources/schema.sql12
1 files changed, 11 insertions, 1 deletions
diff --git a/gentoobrowse/datasources/schema.sql b/gentoobrowse/datasources/schema.sql
index dc6919d..54e1351 100644
--- a/gentoobrowse/datasources/schema.sql
+++ b/gentoobrowse/datasources/schema.sql
@@ -331,9 +331,19 @@ CREATE TABLE files (
filetypeid integer NOT NULL,
repoid integer NOT NULL,
filesize integer NOT NULL,
- pathparts text[] NOT NULL
+ pathparts text[] NOT NULL,
+ encoding text
);
ALTER TABLE files OWNER TO gentoo;
+-- Name: filecontent(files); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo
+CREATE FUNCTION filecontent(f files) RETURNS text
+ LANGUAGE plpgsql IMMUTABLE
+ AS $$
+begin
+ return CONVERT_FROM(PG_READ_BINARY_FILE(f.filename), COALESCE(f.encoding, 'utf-8'));
+end
+$$;
+ALTER FUNCTION gentoobrowse.filecontent(f files) OWNER TO gentoo;
-- Name: filetypes; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace:
CREATE TABLE filetypes (
filetypeid integer NOT NULL,