Commit 202fc033 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Removed "not null" statements and reorganized a bit to prevent db upgrade

issues.  Should probably aim to put the not null's back at some point
if possible, but for now...


git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10804 b35dd754-fafc-0310-a699-88a17e54d16e
parent 7e21dde4
...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp ( ...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp (
); );
-- add new indexed column to mucRoom -- add new indexed column to mucRoom
ALTER TABLE mucRoom ADD COLUMN serviceID INTEGER NOT NULL; ALTER TABLE mucRoom ADD COLUMN serviceID INTEGER;
CREATE INDEX mucRm_serviceid_idx ON mucRoom (serviceID); CREATE INDEX mucRm_serviceid_idx ON mucRoom (serviceID);
-- change mucRoom primary key to be referenced around serviceID -- change mucRoom primary key to be referenced around serviceID
ALTER TABLE mucRoom DROP CONSTRAINT mucRoom_pk; ALTER TABLE mucRoom DROP CONSTRAINT mucRoom_pk;
ALTER TABLE mucRoom ADD CONSTRAINT mucRoom_pk PRIMARY KEY (serviceID, name);
-- add default entry for conference service and associated jiveID value -- add default entry for conference service and associated jiveID value
INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference'); INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference');
...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1); ...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1);
-- update all entries in mucRoom to be set to the default conference service -- update all entries in mucRoom to be set to the default conference service
UPDATE mucRoom set serviceID = 1; UPDATE mucRoom set serviceID = 1;
-- complete change mucRoom primary key to be referenced around serviceID
ALTER TABLE mucRoom ADD CONSTRAINT mucRoom_pk PRIMARY KEY (serviceID, name);
-- update conference name/desc if there is a custom one set -- update conference name/desc if there is a custom one set
UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ) UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' )
WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ); WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' );
......
...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp ( ...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp (
); );
# add new indexed column to mucRoom # add new indexed column to mucRoom
ALTER TABLE mucRoom ADD COLUMN serviceID BIGINT NOT NULL FIRST; ALTER TABLE mucRoom ADD COLUMN serviceID BIGINT FIRST;
ALTER TABLE mucRoom ADD INDEX mucRoom_serviceid_idx (serviceID); ALTER TABLE mucRoom ADD INDEX mucRoom_serviceid_idx (serviceID);
# change mucRooms primary key to be referenced around serviceID # change mucRooms primary key to be referenced around serviceID
ALTER TABLE mucRoom DROP PRIMARY KEY; ALTER TABLE mucRoom DROP PRIMARY KEY;
ALTER TABLE mucRoom ADD PRIMARY KEY (serviceID,name);
# add default entry for conference service and associated jiveID value # add default entry for conference service and associated jiveID value
INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference'); INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference');
...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1); ...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1);
# update all entries in mucRoom to be set to the default conference service # update all entries in mucRoom to be set to the default conference service
UPDATE mucRoom set serviceID = 1; UPDATE mucRoom set serviceID = 1;
# complete change mucRooms primary key to be referenced around serviceID
ALTER TABLE mucRoom ADD PRIMARY KEY (serviceID,name);
# update conference name/desc if theres a custom one set # update conference name/desc if theres a custom one set
UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ) UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' )
WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ); WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' );
......
...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp ( ...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp (
); );
-- add new indexed column to mucRoom -- add new indexed column to mucRoom
ALTER TABLE mucRoom ADD serviceID INT NOT NULL; ALTER TABLE mucRoom ADD serviceID INT;
CREATE INDEX mucRm_serviceid_idx ON mucRoom (serviceID); CREATE INDEX mucRm_serviceid_idx ON mucRoom (serviceID);
-- change mucRoom primary key to be referenced around serviceID -- change mucRoom primary key to be referenced around serviceID
ALTER TABLE mucRoom DROP CONSTRAINT mucRoom_pk; ALTER TABLE mucRoom DROP CONSTRAINT mucRoom_pk;
ALTER TABLE mucRoom ADD CONSTRAINT mucRoom_pk PRIMARY KEY (serviceID, name);
-- add default entry for conference service and associated jiveID value -- add default entry for conference service and associated jiveID value
INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference'); INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference');
...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1); ...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1);
-- update all entries in mucRoom to be set to the default conference service -- update all entries in mucRoom to be set to the default conference service
UPDATE mucRoom set serviceID = 1; UPDATE mucRoom set serviceID = 1;
-- finish change mucRoom primary key to be referenced around serviceID
ALTER TABLE mucRoom ADD CONSTRAINT mucRoom_pk PRIMARY KEY (serviceID, name);
-- update conference name/desc if there is a custom one set -- update conference name/desc if there is a custom one set
UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ) UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' )
WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ); WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' );
......
...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp ( ...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp (
); );
/* add new indexed column to mucRoom */ /* add new indexed column to mucRoom */
ALTER TABLE mucRoom ADD serviceID INT NOT NULL; ALTER TABLE mucRoom ADD serviceID INT;
CREATE INDEX mucRoom_serviceid_idx ON mucRoom(serviceID); CREATE INDEX mucRoom_serviceid_idx ON mucRoom(serviceID);
/* change mucRoom primary key to be referenced around serviceID */ /* change mucRoom primary key to be referenced around serviceID */
ALTER TABLE mucRoom DROP CONSTRAINT mucRoom_pk; ALTER TABLE mucRoom DROP CONSTRAINT mucRoom_pk;
ALTER TABLE mucRoom ADD CONSTRAINT mucRoom_pk PRIMARY KEY (serviceID, name);
/* add default entry for conference service and associated jiveID value */ /* add default entry for conference service and associated jiveID value */
INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference'); INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference');
...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1); ...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1);
/* update all entries in mucRoom to be set to the default conference service */ /* update all entries in mucRoom to be set to the default conference service */
UPDATE mucRoom set serviceID = 1; UPDATE mucRoom set serviceID = 1;
/* finish change mucRoom primary key to be referenced around serviceID */
ALTER TABLE mucRoom ADD CONSTRAINT mucRoom_pk PRIMARY KEY (serviceID, name);
/* update conference name/desc if there is a custom one set */ /* update conference name/desc if there is a custom one set */
UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ) UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' )
WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ); WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' );
......
...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp ( ...@@ -16,12 +16,11 @@ CREATE TABLE mucServiceProp (
); );
/* add new indexed column to mucRoom */ /* add new indexed column to mucRoom */
ALTER TABLE mucRoom ADD COLUMN serviceID INT NOT NULL; ALTER TABLE mucRoom ADD COLUMN serviceID INT;
CREATE INDEX mucRoom_serviceid_idx ON mucRoom(serviceID); CREATE INDEX mucRoom_serviceid_idx ON mucRoom(serviceID);
/* change mucRoom primary key to be referenced around serviceID */ /* change mucRoom primary key to be referenced around serviceID */
ALTER TABLE mucRoom DROP CONSTRAINT mucRoom_pk; ALTER TABLE mucRoom DROP CONSTRAINT mucRoom_pk;
ALTER TABLE mucRoom ADD CONSTRAINT mucRoom_pk PRIMARY KEY (serviceID, name);
/* add default entry for conference service and associated jiveID value */ /* add default entry for conference service and associated jiveID value */
INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference'); INSERT INTO mucService (serviceID, subdomain) VALUES (1, 'conference');
...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1); ...@@ -30,6 +29,9 @@ INSERT INTO jiveID (idType, id) VALUES (26, 1);
/* update all entries in mucRoom to be set to the default conference service */ /* update all entries in mucRoom to be set to the default conference service */
UPDATE mucRoom set serviceID = 1; UPDATE mucRoom set serviceID = 1;
/* finish change mucRoom primary key to be referenced around serviceID */
ALTER TABLE mucRoom ADD CONSTRAINT mucRoom_pk PRIMARY KEY (serviceID, name);
/* update conference name/desc if there is a custom one set */ /* update conference name/desc if there is a custom one set */
UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ) UPDATE mucService SET mucService.subdomain = ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' )
WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' ); WHERE EXISTS ( SELECT jiveProperty.propValue FROM jiveProperty WHERE jiveProperty.name = 'xmpp.muc.service' );
......
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