From 6691c59a7ab2993f186f9b3309f440cd60ae3bcb Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Wed, 17 May 2017 19:29:19 +0300 Subject: [PATCH] Clean up database code related to mod_vcard_xupdate --- sql/lite.sql | 6 ------ sql/mssql.sql | 10 ---------- sql/mysql.sql | 6 ------ sql/pg.sql | 6 ------ src/ejabberd_config.erl | 2 +- src/ejd2sql.erl | 3 +-- src/mod_vcard_xupdate.erl | 10 +++++++++- 7 files changed, 11 insertions(+), 32 deletions(-) diff --git a/sql/lite.sql b/sql/lite.sql index 1d057407f..1cc0c4dc5 100644 --- a/sql/lite.sql +++ b/sql/lite.sql @@ -116,12 +116,6 @@ CREATE TABLE vcard ( created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); -CREATE TABLE vcard_xupdate ( - username text PRIMARY KEY, - hash text NOT NULL, - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP -); - CREATE TABLE vcard_search ( username text NOT NULL, lusername text PRIMARY KEY, diff --git a/sql/mssql.sql b/sql/mssql.sql index 72b490ecc..607acae8f 100644 --- a/sql/mssql.sql +++ b/sql/mssql.sql @@ -470,16 +470,6 @@ WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW CREATE INDEX [vcard_search_lorgunit] ON [vcard_search] (lorgunit) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); -CREATE TABLE [dbo].[vcard_xupdate] ( - [username] [varchar] (250) NOT NULL, - [hash] [text] NOT NULL, - [created_at] [datetime] NOT NULL DEFAULT GETDATE(), - CONSTRAINT [vcard_xupdate_PRIMARY] PRIMARY KEY CLUSTERED -( - [username] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) -) TEXTIMAGE_ON [PRIMARY]; - ALTER TABLE [dbo].[pubsub_item] WITH CHECK ADD CONSTRAINT [pubsub_item_ibfk_1] FOREIGN KEY([nodeid]) REFERENCES [dbo].[pubsub_node] ([nodeid]) ON DELETE CASCADE; diff --git a/sql/mysql.sql b/sql/mysql.sql index c591cb761..3fddea510 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -121,12 +121,6 @@ CREATE TABLE vcard ( created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -CREATE TABLE vcard_xupdate ( - username varchar(191) PRIMARY KEY, - hash text NOT NULL, - created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP -) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - CREATE TABLE vcard_search ( username varchar(191) NOT NULL, lusername varchar(191) PRIMARY KEY, diff --git a/sql/pg.sql b/sql/pg.sql index 539c1263a..f761e68da 100644 --- a/sql/pg.sql +++ b/sql/pg.sql @@ -120,12 +120,6 @@ CREATE TABLE vcard ( created_at TIMESTAMP NOT NULL DEFAULT now() ); -CREATE TABLE vcard_xupdate ( - username text PRIMARY KEY, - hash text NOT NULL, - created_at TIMESTAMP NOT NULL DEFAULT now() -); - CREATE TABLE vcard_search ( username text NOT NULL, lusername text PRIMARY KEY, diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl index 1dc30b1c5..1e5d495ce 100644 --- a/src/ejabberd_config.erl +++ b/src/ejabberd_config.erl @@ -1092,7 +1092,7 @@ replace_module(mod_roster_odbc) -> {mod_roster, sql}; replace_module(mod_shared_roster_odbc) -> {mod_shared_roster, sql}; replace_module(mod_vcard_odbc) -> {mod_vcard, sql}; replace_module(mod_vcard_ldap) -> {mod_vcard, ldap}; -replace_module(mod_vcard_xupdate_odbc) -> {mod_vcard_xupdate, sql}; +replace_module(mod_vcard_xupdate_odbc) -> mod_vcard_xupdate; replace_module(mod_pubsub_odbc) -> {mod_pubsub, sql}; replace_module(mod_http_bind) -> mod_bosh; replace_module(Module) -> diff --git a/src/ejd2sql.erl b/src/ejd2sql.erl index 343c3518a..c4f00a551 100644 --- a/src/ejd2sql.erl +++ b/src/ejd2sql.erl @@ -60,8 +60,7 @@ modules() -> mod_private, mod_roster, mod_shared_roster, - mod_vcard, - mod_vcard_xupdate]. + mod_vcard]. export(Server, Output) -> LServer = jid:nameprep(iolist_to_binary(Server)), diff --git a/src/mod_vcard_xupdate.erl b/src/mod_vcard_xupdate.erl index 0da8198d9..74f6b7364 100644 --- a/src/mod_vcard_xupdate.erl +++ b/src/mod_vcard_xupdate.erl @@ -162,6 +162,14 @@ compute_hash(VCard) -> %%==================================================================== %% Options %%==================================================================== +mod_opt_type(db_type) -> + fun(_) -> + ?WARNING_MSG("option 'db_type' for module '~s' has no effect: " + "the module doesn't require database anymore; " + "feel free to delete any tables related to the module", + [?MODULE]), + erlang:error(badarg) + end; mod_opt_type(O) when O == cache_life_time; O == cache_size -> fun (I) when is_integer(I), I > 0 -> I; (infinity) -> infinity @@ -169,4 +177,4 @@ mod_opt_type(O) when O == cache_life_time; O == cache_size -> mod_opt_type(O) when O == use_cache; O == cache_missed -> fun (B) when is_boolean(B) -> B end; mod_opt_type(_) -> - [cache_life_time, cache_size, use_cache, cache_missed]. + [db_type, cache_life_time, cache_size, use_cache, cache_missed].