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:
parent
f6e8eb52f0
commit
c1af36ac20
28 changed files with 1733 additions and 19 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue