3 lang text NOT NULL DEFAULT 'eng',
4 cat integer REFERENCES word (id),
5 ref integer REFERENCES word (id),
6 prio smallint NOT NULL DEFAULT '1',
10 created timestamptz DEFAULT now(),
11 id serial NOT NULL PRIMARY KEY
14 COMMENT ON COLUMN word.form IS 'preferred textual representation';
15 COMMENT ON COLUMN word.lang IS 'ISO 639-3 language code';
16 COMMENT ON COLUMN word.cat IS 'hierarchical classification';
17 COMMENT ON COLUMN word.ref IS 'reference to equivalent eng translation';
18 COMMENT ON COLUMN word.prio IS 'difficulty level or importance; lower values have precedence';
19 COMMENT ON COLUMN word.source IS 'URI of downloaded image';
20 COMMENT ON COLUMN word.thumb IS 'ImageMagick convert options to create thumbnail from source image';
21 COMMENT ON COLUMN word.wptitle IS 'reference Wikipedia article';
23 CREATE OR REPLACE VIEW _cat_words AS
24 SELECT * FROM word RIGHT JOIN (
25 SELECT cat id, array_agg(form ORDER BY form) forms
26 FROM word WHERE ref IS NULL GROUP BY cat