From: Mischa POSLAWSKY Date: Fri, 2 Jul 2021 16:03:55 +0000 (+0200) Subject: word: reorder table columns X-Git-Tag: v1.13~186 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/711e9f664d747034090f834acce9f5bc86f99e99 word: reorder table columns --- diff --git a/tools/word.pg.sql b/tools/word.pg.sql index 7aacfa8..fb1e5d1 100644 --- a/tools/word.pg.sql +++ b/tools/word.pg.sql @@ -20,8 +20,8 @@ CREATE TABLE word ( source text CHECK (source ~ '^https?://'), thumb text[], wptitle text, - created timestamptz DEFAULT now(), creator integer REFERENCES login (id), + created timestamptz DEFAULT now(), updated timestamptz, id serial NOT NULL PRIMARY KEY ); @@ -54,14 +54,13 @@ CREATE OR REPLACE VIEW _word_ref AS coalesce(r.cat, w.cat ) cat, --TODO translate w? coalesce(r.ref, r.id ) "ref", coalesce(r.prio, w.prio ) prio, + coalesce(r.grade, w.grade ) grade, + coalesce(r.cover, w.cover ) cover, coalesce(r.source, w.source ) source, coalesce(r.thumb, w.thumb ) thumb, coalesce(r.wptitle, w.wptitle) wptitle, - r.created, r.updated, - CASE WHEN r.source IS NULL THEN w.id ELSE r.id END id, -- image id - coalesce(r.cover, w.cover ) cover, - coalesce(r.grade, w.grade ) grade, - r.creator + r.creator, r.created, r.updated, + CASE WHEN r.source IS NULL THEN w.id ELSE r.id END id -- image id FROM word r LEFT JOIN word w ON w.id = r.ref;