Check on [Recipe].[lang]

This commit is contained in:
Greg Burri 2025-05-06 16:40:17 +02:00
parent d2733ccf01
commit eb47844f05

View file

@ -69,7 +69,7 @@ CREATE TABLE [Recipe] (
[id] INTEGER PRIMARY KEY,
[user_id] INTEGER, -- Can be null if a user is deleted.
[title] TEXT NOT NULL,
-- https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes
-- https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes (Set 1).
[lang] TEXT NOT NULL DEFAULT 'en',
[estimated_time] INTEGER, -- in [s].
[description] TEXT NOT NULL DEFAULT '',
@ -80,6 +80,7 @@ CREATE TABLE [Recipe] (
[creation_datetime] TEXT NOT NULL,
CHECK (
length([lang]) = 2 AND
length([title]) <= 255 AND
length([description]) <= 65535 AND
[difficulty] >= 0 AND [difficulty] <= 3