mirror of
https://github.com/processone/ejabberd
synced 2025-10-05 19:42:11 +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,28 @@
|
|||
%%%===================================================================
|
||||
%%% 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 = <<"private_storage">>,
|
||||
columns =
|
||||
[#sql_column{name = <<"username">>, type = text},
|
||||
#sql_column{name = <<"server_host">>, type = text},
|
||||
#sql_column{name = <<"namespace">>, type = text},
|
||||
#sql_column{name = <<"data">>, type = text},
|
||||
#sql_column{name = <<"created_at">>, type = timestamp,
|
||||
default = true}],
|
||||
indices = [#sql_index{
|
||||
columns = [<<"server_host">>, <<"username">>,
|
||||
<<"namespace">>],
|
||||
unique = true}]}]}].
|
||||
|
||||
set_data(LUser, LServer, Data) ->
|
||||
F = fun() ->
|
||||
lists:foreach(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue