Determines if commit history is enabled for the current scope or a specified target scope.
@thingsdb scope, but cannot be used in a @node scope as commit history cannot be enabled for a node scope.scope): Allowed only in the @thingsdb scope. Checks whether commit history is enabled for the given scope.Checking if commit history is enabled requires at least QUERY privileges for the target scope (viewing the actual history via history() requires CHANGE privileges as well).
This function does not generate a change.
history_enabled([scope])
| Argument | Type | Description |
|---|---|---|
| scope | str (optional) | Target scope name (e.g. '//stuff', '@collection:stuff', or '/thingsdb'). Only allowed when called in the @thingsdb scope. |
Returns true if commit history is enabled for the scope and otherwise false.
This code shows an example use case of history_enabled() in the current scope:
history_enabled();
Return value in JSON format
false
This code shows an example use case of history_enabled() in the
@thingsdbscope:
// Enable commit history on the //stuff collection
set_history('//stuff', true);
[
history_enabled('//stuff'),
history_enabled('/thingsdb'),
];
Return value in JSON format
[
true,
false
]