CREATE TRIGGER IF NOT EXISTS enforce_size_id
BEFORE INSERT ON Preferences
BEGIN
    SELECT
        CASE
            WHEN (
                SELECT COUNT(*) FROM Sizes WHERE id = new.size_id
            ) = 0
            THEN RAISE(ABORT, 'Size does not exist')
        END;
END;
