Commit 20a75d52 authored by Dave Cridland's avatar Dave Cridland

OF-1246 Database updates in support of MAM-MUC

This patch updates the database for MAM-MUC support:
* Upgrade scripts simply update the version, since previous patches included these updates in upgrades.
* New installations have the fields added.
* MUC history logging adds the MAM message identifier.
parent c04203ef
......@@ -261,6 +261,7 @@ CREATE TABLE ofMucMember (
CREATE TABLE ofMucConversationLog (
roomID INTEGER NOT NULL,
messageID INTEGER NOT NULL,
sender VARCHAR(2000) NOT NULL,
nickname VARCHAR(255),
logTime CHAR(15) NOT NULL,
......@@ -269,6 +270,7 @@ CREATE TABLE ofMucConversationLog (
stanza CLOB
);
CREATE INDEX ofMucConvLog_time_idx ON ofMucConversationLog (logTime);
CREATE INDEX ofMucConvLog_msg_id ON ofMucConversationLog (messageID);
-- PubSub Tables
......@@ -392,7 +394,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 24);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 25);
-- Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -253,6 +253,7 @@ CREATE TABLE ofMucMember (
CREATE TABLE ofMucConversationLog (
roomID BIGINT NOT NULL,
messageID BIGINT NOT NULL,
sender VARCHAR(1024) NOT NULL,
nickname VARCHAR(255) NULL,
logTime CHAR(15) NOT NULL,
......@@ -261,6 +262,7 @@ CREATE TABLE ofMucConversationLog (
stanza LONGVARCHAR NULL
);
CREATE INDEX ofMucConversationLog_time_idx ON ofMucConversationLog (logTime);
CREATE INDEX ofMucConversationLog_msg_id ON ofMucConversationLog (messageID);
// PubSub Tables
......@@ -378,7 +380,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 24);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 25);
// Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -242,13 +242,15 @@ CREATE TABLE ofMucMember (
CREATE TABLE ofMucConversationLog (
roomID BIGINT NOT NULL,
messageID BIGINT NOT NULL,
sender TEXT NOT NULL,
nickname VARCHAR(255) NULL,
logTime CHAR(15) NOT NULL,
subject VARCHAR(255) NULL,
body TEXT NULL,
stanza TEXT NULL,
INDEX ofMucConversationLog_time_idx (logTime)
INDEX ofMucConversationLog_time_idx (logTime),
INDEX ofMucConversationLog_msg_id (messageID);
);
# PubSub Tables
......@@ -367,7 +369,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 24);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 25);
# Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -250,6 +250,7 @@ CREATE TABLE ofMucMember (
CREATE TABLE ofMucConversationLog (
roomID INT NOT NULL,
messageID INT NOT NULL,
sender VARCHAR2(1024) NOT NULL,
nickname VARCHAR2(255) NULL,
logTime CHAR(15) NOT NULL,
......@@ -258,6 +259,8 @@ CREATE TABLE ofMucConversationLog (
stanza VARCHAR2(4000) NULL
);
CREATE INDEX ofMucConversationLog_time_idx ON ofMucConversationLog (logTime);
CREATE INDEX ofMucConversationLog_msg_id ON ofMucConversationLog (messageID);
-- PubSub Tables
......@@ -375,7 +378,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 24);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 25);
-- Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -258,6 +258,7 @@ CREATE TABLE ofMucMember (
CREATE TABLE ofMucConversationLog (
roomID INTEGER NOT NULL,
messageID INTEGER NOT NULL,
sender VARCHAR(1024) NOT NULL,
nickname VARCHAR(255) NULL,
logTime CHAR(15) NOT NULL,
......@@ -266,6 +267,8 @@ CREATE TABLE ofMucConversationLog (
stanza TEXT NULL
);
CREATE INDEX ofMucConversationLog_time_idx ON ofMucConversationLog (logTime);
CREATE INDEX ofMucConversationLog_msg_id ON ofMucConversationLog (messageID);
-- PubSub Tables
......@@ -383,7 +386,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 24);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 25);
-- Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -256,6 +256,7 @@ CREATE TABLE ofMucMember (
CREATE TABLE ofMucConversationLog (
roomID INT NOT NULL,
messageID INT NOT NULL,
sender NVARCHAR(1024) NOT NULL,
nickname NVARCHAR(255) NULL,
logTime CHAR(15) NOT NULL,
......@@ -264,6 +265,7 @@ CREATE TABLE ofMucConversationLog (
stanza NTEXT NULL
);
CREATE INDEX ofMucConversationLog_time_idx ON ofMucConversationLog (logTime);
CREATE INDEX ofMucConversationLog_msg_id ON ofMucConversationLog (messageID);
/* PubSub Tables */
......@@ -381,7 +383,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 24);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 25);
/* Entry for admin user */
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -256,6 +256,7 @@ CREATE TABLE ofMucMember (
CREATE TABLE ofMucConversationLog (
roomID INT NOT NULL,
messageID INT NOT NULL,
sender TEXT NOT NULL,
nickname NVARCHAR(255) NULL,
logTime CHAR(15) NOT NULL,
......@@ -264,6 +265,8 @@ CREATE TABLE ofMucConversationLog (
stanza TEXT NULL
);
CREATE INDEX ofMucConversationLog_time_idx ON ofMucConversationLog (logTime);
CREATE INDEX ofMucConversationLog_msg_id ON ofMucConversationLog (messageID);
/* PubSub Tables */
......@@ -381,7 +384,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 24);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 25);
/* Entry for admin user */
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
UPDATE ofVersion SET version = 25 WHERE name = 'openfire';
UPDATE ofVersion SET version = 24 WHERE name = 'openfire';
\ No newline at end of file
UPDATE ofVersion SET version = 24 WHERE name = 'openfire';
\ No newline at end of file
UPDATE ofVersion SET version = 24 WHERE name = 'openfire';
\ No newline at end of file
UPDATE ofVersion SET version = 24 WHERE name = 'openfire';
\ No newline at end of file
UPDATE ofVersion SET version = 24 WHERE name = 'openfire';
\ No newline at end of file
UPDATE ofVersion SET version = 24 WHERE name = 'openfire';
\ No newline at end of file
......@@ -68,7 +68,7 @@ public class SchemaManager {
/**
* Current Openfire database schema version.
*/
private static final int DATABASE_VERSION = 24;
private static final int DATABASE_VERSION = 25;
/**
* Checks the Openfire database schema to ensure that it's installed and up to date.
......
......@@ -129,8 +129,8 @@ public class MUCPersistenceManager {
private static final String DELETE_USER_MUCAFFILIATION =
"DELETE FROM ofMucAffiliation WHERE jid=?";
private static final String ADD_CONVERSATION_LOG =
"INSERT INTO ofMucConversationLog (roomID,sender,nickname,logTime,subject,body,stanza) " +
"VALUES (?,?,?,?,?,?,?)";
"INSERT INTO ofMucConversationLog (roomID,messageID,sender,nickname,logTime,subject,body,stanza) " +
"SELECT ?,COUNT(*),?,?,?,?,?,? FROM ofMucConversationLog";
/* Map of subdomains to their associated properties */
private static ConcurrentHashMap<String,MUCServiceProperties> propertyMaps = new ConcurrentHashMap<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment