Skip to content

Commit

Permalink
OF-2954: Database install and update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
guusdk committed Jan 15, 2025
1 parent a4c4798 commit 05865cc
Show file tree
Hide file tree
Showing 15 changed files with 196 additions and 11 deletions.
12 changes: 11 additions & 1 deletion distribution/src/database/openfire_db2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,24 @@ CREATE TABLE ofPubsubDefaultConf (
CONSTRAINT ofPubsubDefConf_pk PRIMARY KEY (serviceID, leaf)
);

CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw LONG VARCHAR NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

-- Finally, insert default table values
INSERT INTO ofID (idType, id) VALUES (18, 1);
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 ofID (idType, id) VALUES (27, 1);

INSERT INTO ofVersion (name, version) VALUES ('openfire', 36);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 376);

-- Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
Expand Down
10 changes: 5 additions & 5 deletions distribution/src/database/openfire_hsqldb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@ CREATE TABLE ofPubsubDefaultConf (
);

CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw LONGVARCHAR NOT NULL
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw LONGVARCHAR NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);
Expand Down
12 changes: 11 additions & 1 deletion distribution/src/database/openfire_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,16 @@ CREATE TABLE ofPubsubDefaultConf (
PRIMARY KEY (serviceID, leaf)
);

CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw TEXT NOT NULL,
INDEX ofSpamReport_created_reporter_id (created, reporter),
INDEX ofSpamReport_created_reported_id (created, reported)
);

# Finally, insert default table values.

INSERT INTO ofID (idType, id) VALUES (18, 1);
Expand All @@ -379,7 +389,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofID (idType, id) VALUES (27, 1);

INSERT INTO ofVersion (name, version) VALUES ('openfire', 36);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 37);

# Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
Expand Down
12 changes: 11 additions & 1 deletion distribution/src/database/openfire_oracle.sql
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,16 @@ CREATE TABLE ofPubsubDefaultConf (
CONSTRAINT ofPubsubDefaultConf_pk PRIMARY KEY (serviceID, leaf)
);

CREATE TABLE ofSpamReport (
reporter VARCHAR2(1024) NOT NULL,
reported VARCHAR2(1024) NOT NULL,
reason VARCHAR2(255) NOT NULL,
created INTEGER NOT NULL,
"raw" CLOB NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

-- Finally, insert default table values.

INSERT INTO ofID (idType, id) VALUES (18, 1);
Expand All @@ -387,7 +397,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofID (idType, id) VALUES (27, 1);

INSERT INTO ofVersion (name, version) VALUES ('openfire', 36);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 37);

-- Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
Expand Down
12 changes: 11 additions & 1 deletion distribution/src/database/openfire_postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,16 @@ CREATE TABLE ofPubsubDefaultConf (
CONSTRAINT ofPubsubDefaultConf_pk PRIMARY KEY (serviceID, leaf)
);

CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw TEXT NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

-- Finally, insert default table values.

INSERT INTO ofID (idType, id) VALUES (18, 1);
Expand All @@ -395,7 +405,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 2);
INSERT INTO ofID (idType, id) VALUES (27, 1);

INSERT INTO ofVersion (name, version) VALUES ('openfire', 36);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 37);

-- Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
Expand Down
10 changes: 10 additions & 0 deletions distribution/src/database/openfire_sqlserver.sql
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ CREATE TABLE ofPubsubDefaultConf (
CONSTRAINT ofPubsubDefaultConf_pk PRIMARY KEY (serviceID, leaf)
);

CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw NVARCHAR(MAX) NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

/* Finally, insert default table values. */

INSERT INTO ofID (idType, id) VALUES (18, 1);
Expand Down
10 changes: 10 additions & 0 deletions distribution/src/database/openfire_sybase.sql
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ CREATE TABLE ofPubsubDefaultConf (
CONSTRAINT ofPubsubDefaultConf_pk PRIMARY KEY (serviceID, leaf)
)

CREATE TABLE ofSpamReport (
reporter NVARCHAR(1024) NOT NULL,
reported NVARCHAR(1024) NOT NULL,
reason NVARCHAR(255) NOT NULL,
created INTEGER NOT NULL,
"raw" LONG VARCHAR NOT NULL
)
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter)
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported)

/* Finally, insert default table values. */

INSERT INTO ofID (idType, id) VALUES (18, 1)
Expand Down
11 changes: 11 additions & 0 deletions distribution/src/database/upgrade/37/openfire_db2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw LONG VARCHAR NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

UPDATE ofVersion SET version = 37 WHERE name = 'openfire';
11 changes: 11 additions & 0 deletions distribution/src/database/upgrade/37/openfire_hsqldb.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw LONGVARCHAR NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

UPDATE ofVersion SET version = 37 WHERE name = 'openfire';
11 changes: 11 additions & 0 deletions distribution/src/database/upgrade/37/openfire_mysql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw TEXT NOT NULL,
INDEX ofSpamReport_created_reporter_id (created, reporter),
INDEX ofSpamReport_created_reported_id (created, reported)
);

UPDATE ofVersion SET version = 37 WHERE name = 'openfire';
11 changes: 11 additions & 0 deletions distribution/src/database/upgrade/37/openfire_oracle.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE ofSpamReport (
reporter VARCHAR2(1024) NOT NULL,
reported VARCHAR2(1024) NOT NULL,
reason VARCHAR2(255) NOT NULL,
created INTEGER NOT NULL,
"raw" CLOB NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

UPDATE ofVersion SET version = 37 WHERE name = 'openfire';
11 changes: 11 additions & 0 deletions distribution/src/database/upgrade/37/openfire_postgresql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw TEXT NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

UPDATE ofVersion SET version = 37 WHERE name = 'openfire';
11 changes: 11 additions & 0 deletions distribution/src/database/upgrade/37/openfire_sqlserver.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE ofSpamReport (
reporter VARCHAR(1024) NOT NULL,
reported VARCHAR(1024) NOT NULL,
reason VARCHAR(255) NOT NULL,
created BIGINT NOT NULL,
raw NVARCHAR(MAX) NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

UPDATE ofVersion SET version = 37 WHERE name = 'openfire';
11 changes: 11 additions & 0 deletions distribution/src/database/upgrade/37/openfire_sybase.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE ofSpamReport (
reporter NVARCHAR(1024) NOT NULL,
reported NVARCHAR(1024) NOT NULL,
reason NVARCHAR(255) NOT NULL,
created INTEGER NOT NULL,
"raw" LONG VARCHAR NOT NULL
);
CREATE INDEX ofSpamReport_created_reporter_id ON ofSpamReport (created, reporter);
CREATE INDEX ofSpamReport_created_reported_id ON ofSpamReport (created, reported);

UPDATE ofVersion SET version = 37 WHERE name = 'openfire';
52 changes: 50 additions & 2 deletions documentation/database-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ <h2>Database Tables</h2>
<li><a href="#ofExtComponentConf">ofExtComponentConf</a></li>
<li><a href="#ofRemoteServerConf">ofRemoteServerConf</a></li>
<li><a href="#ofSecurityAuditLog">ofSecurityAuditLog</a></li>

<li><a href="#ofMucService">ofMucService</a></li>
<li><a href="#ofMucServiceProp">ofMucServiceProp</a></li>
<li><a href="#ofMucRoom">ofMucRoom</a></li>

<li><a href="#ofMucRoomProp">ofMucRoomProp</a></li>
<li><a href="#ofMucRoomRetiree">ofMucRoomRetiree</a></li>
<li><a href="#ofMucAffiliation">ofMucAffiliation</a></li>
Expand All @@ -101,9 +101,10 @@ <h2>Database Tables</h2>
<li><a href="#ofPubsubNodeGroups">ofPubsubNodeGroups</a></li>
<li><a href="#ofPubsubAffiliation">ofPubsubAffiliation</a></li>
<li><a href="#ofPubsubItem">ofPubsubItem</a></li>

<li><a href="#ofPubsubSubscription">ofPubsubSubscription</a></li>
<li><a href="#ofPubsubDefaultConf">ofPubsubDefaultConf</a></li>

<li><a href="#ofSpamReport">ofSpamReport</a></li>
</ul>
</nav>

Expand Down Expand Up @@ -1802,6 +1803,53 @@ <h2>Database Tables</h2>

&nbsp;<a href="#top" class="top">top of page</a>

<table id="ofSpamReport" class="dbtable">
<tbody>
<tr>
<th colspan="4">ofSpamReport (spam rapportage)</th>
</tr>
<tr>
<th>Column Name</th>
<th>Type</th>
<th>Length</th>
<th>Description</th>
</tr>
<tr>
<td>reporter</td>
<td>VARCHAR</td>
<td>1024</td>
<td>JID of entity that is reporting the spam</td>
</tr>
<tr>
<td>reported</td>
<td>VARCHAR</td>
<td>1024</td>
<td>JID of entity that is being reported (the 'offender')</td>
</tr>
<tr>
<td>reason</td>
<td>VARCHAR</td>
<td>255</td>
<td>Identifier (typically a namespace) for the type of spam report</td>
</tr>
<tr>
<td>created</td>
<td>NUMBER</td>
<td></td>
<td>Epoch millis of the creation time of the report</td>
</tr>
<tr>
<td>raw</td>
<td>CLOB</td>
<td></td>
<td>XML representation of the report</td>
</tr>
</tbody>

&nbsp;<a href="#top" class="top">top of page</a>

</table>

</section>

<footer>
Expand Down

0 comments on commit 05865cc

Please sign in to comment.