1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-04 10:19:31 +02:00

Automatically create and update SQL schema

This commit is contained in:
Alexey Shchepin 2023-09-28 03:37:36 +03:00
parent f6e8eb52f0
commit c1af36ac20
28 changed files with 1733 additions and 19 deletions

View file

@ -37,9 +37,25 @@
%%%===================================================================
%%% API
%%%===================================================================
init(_Host, _Opts) ->
init(Host, _Opts) ->
ejabberd_sql_schema:update_schema(Host, ?MODULE, schemas()),
ok.
schemas() ->
[#sql_schema{
version = 1,
tables =
[#sql_table{
name = <<"caps_features">>,
columns =
[#sql_column{name = <<"node">>, type = text},
#sql_column{name = <<"subnode">>, type = text},
#sql_column{name = <<"feature">>, type = text},
#sql_column{name = <<"created_at">>, type = timestamp,
default = true}],
indices = [#sql_index{
columns = [<<"node">>, <<"subnode">>]}]}]}].
caps_read(LServer, {Node, SubNode}) ->
case ejabberd_sql:sql_query(
LServer,