summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2022-02-19 14:09:12 +0100
committerYorhel <git@yorhel.nl>2022-02-19 14:09:14 +0100
commit33b209a8c90a2bfc8d796c817b3c677402fc4a5e (patch)
tree28113934ed575658ea6de20f30b4dce7502ee5e3 /sql
parent43a707c5298409f326ae15b8771e63945a29e5d5 (diff)
Use special "vnt.sorttitle" column for sorting & alphabet filtering
This column simply picks the latin version of the chosen display title, as if the "latin" checkbox is always set.
Diffstat (limited to 'sql')
-rw-r--r--sql/schema.sql14
1 files changed, 7 insertions, 7 deletions
diff --git a/sql/schema.sql b/sql/schema.sql
index 1d6d0e5e..13e5f20f 100644
--- a/sql/schema.sql
+++ b/sql/schema.sql
@@ -1252,10 +1252,10 @@ CREATE TABLE wikidata (
);
--- The 'vnt' view is equivalent to the 'vn' table with two additional columns:
--- 'title' and 'alttitle', which represent the display title and the
--- alternative (mouse-hover) title. The view defined here displays the
--- latin/title name of the original language as main title and the title in the
--- original script as alttitle, but this view can be redefined as a TEMPORARY
--- VIEW in sessions to override the default behavior.
-CREATE VIEW vnt AS SELECT v.*, COALESCE(vo.latin, vo.title) AS title, CASE WHEN vo.latin IS NULL THEN '' ELSE vo.title END AS alttitle FROM vn v JOIN vn_titles vo ON vo.id = v.id AND vo.lang = v.olang;
+-- The 'vnt' view is equivalent to the 'vn' table with three additional columns:
+-- title - main display title
+-- sorttitle - title used for sorting and alphabet filter (i.e. latin version of 'title')
+-- alttitle - alternative display title (for e.g. tooltips)
+-- This view can be redefined as a TEMPORARY VIEW in sessions to override the
+-- default behavior.
+CREATE VIEW vnt AS SELECT v.*, COALESCE(vo.latin, vo.title) AS title, COALESCE(vo.latin, vo.title) AS sorttitle, CASE WHEN vo.latin IS NULL THEN '' ELSE vo.title END AS alttitle FROM vn v JOIN vn_titles vo ON vo.id = v.id AND vo.lang = v.olang;