word edit: null priority to inherit from parent
[sheet.git] / tools / word.pg.sql
index d18a99cb4b3172f464f5302832957e910ba9a678..3a0f158b5124f6dcd2d26590c61955ca4224471d 100644 (file)
@@ -13,7 +13,8 @@ CREATE TABLE word (
        lang       text        NOT NULL DEFAULT 'en',
        cat        integer              REFERENCES word (id),
        ref        integer              REFERENCES word (id),
-       prio       smallint    NOT NULL DEFAULT '1',
+       prio       smallint             DEFAULT '1'
+                                       CHECK (prio >= 0 OR ref IS NOT NULL),
        grade      integer,
        cover      boolean     NOT NULL DEFAULT FALSE,
        source     text,