From 1a015a3cf9a06add0281e72ae1b23bd7ef34b53f Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Wed, 19 Oct 2005 23:00:17 +0000 Subject: * src/odbc/pg.sql: Added spool.seq field for offline messages sorting * src/mod_offline_odbc.erl: Likewise SVN Revision: 424 --- src/mod_offline_odbc.erl | 3 ++- src/odbc/pg.sql | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mod_offline_odbc.erl b/src/mod_offline_odbc.erl index ff973717..d7a77ae4 100644 --- a/src/mod_offline_odbc.erl +++ b/src/mod_offline_odbc.erl @@ -214,7 +214,8 @@ pop_offline_messages(Ls, User, Server) -> case ejabberd_odbc:sql_query( LServer, ["begin;" - "select * from spool where username='", EUser, "';" + "select username, xml from spool where username='", EUser, "'" + " order by seq;" "delete from spool where username='", EUser, "';" "commit"]) of [{updated, undefined}, diff --git a/src/odbc/pg.sql b/src/odbc/pg.sql index 5d0799cc..e8404b13 100644 --- a/src/odbc/pg.sql +++ b/src/odbc/pg.sql @@ -36,10 +36,17 @@ CREATE TABLE rostergroups ( CREATE INDEX pk_rosterg_user_jid ON rostergroups USING btree (username, jid); +;; To update from previous table definition: +; CREATE SEQUENCE spool_seq_seq; +; ALTER TABLE spool ADD COLUMN seq integer; +; ALTER TABLE spool ALTER COLUMN seq SET DEFAULT nextval('spool_seq_seq'); +; UPDATE spool SET seq = DEFAULT; +; ALTER TABLE spool ALTER COLUMN seq SET NOT NULL; CREATE TABLE spool ( username text NOT NULL, - xml text + xml text, + seq SERIAL ); CREATE INDEX i_despool ON spool USING btree (username); -- cgit v1.2.3