4.15.22 ensure_tab_vsn(Tab, Version)

-spec ensure_tab_vsn(tab(), integer()) -> {ok,
                                           integer()} |
                                          {error, _}.

Utility function that creates ?tab_vsn key in the table with the specified value.

If this key is already present, and its value is different from the supplied argument, the existing version is returned. Checking the return value and handling of the schema migration is up to the API consumer.

NOTE: this function is just a wrapper over other APIs, it updates a regular key-value pair in the table. Other business logic iterating over the table should be prepared to deal with it, ets:foldl function and on_update callbacks are of particular concern.

WARNING: this function is not atomic.

JavaScript license information