openfire_db2.sql 4.54 KB
Newer Older
1 2 3 4 5 6 7
-- $Revision:  $
-- $Date:  $

-- Rename column
CREATE TABLE jiveRemoteServerConf2 (
  xmppDomain            VARCHAR(255)    NOT NULL,
  remotePort            INTEGER,
Daniel Henninger's avatar
Daniel Henninger committed
8
  permission            VARCHAR(10)     NOT NULL
9 10 11 12 13 14 15
);

INSERT INTO jiveRemoteServerConf2 (xmppDomain, remotePort, permission)
SELECT domain, remotePort, permission FROM jiveRemoteServerConf;

DROP TABLE jiveRemoteServerConf;
RENAME TABLE jiveRemoteServerConf2 TO jiveRemoteServerConf;
Daniel Henninger's avatar
Daniel Henninger committed
16
ALTER TABLE jiveRemoteServerConf ADD CONSTRAINT jiveRmSrvConf_pk PRIMARY KEY (xmppDomain);
17 18 19 20 21 22 23

-- Rename column
CREATE TABLE jiveOffline2 (
  username              VARCHAR(64)     NOT NULL,
  messageID             INTEGER         NOT NULL,
  creationDate          CHAR(15)        NOT NULL,
  messageSize           INTEGER         NOT NULL,
Daniel Henninger's avatar
Daniel Henninger committed
24
  stanza                VARCHAR(2000)   NOT NULL
25 26 27 28 29 30 31 32 33 34 35 36
);

INSERT INTO jiveOffline2 (username, messageID, creationDate, messageSize, stanza)
SELECT username, messageID, creationDate, messageSize, message FROM jiveOffline;

DROP TABLE jiveOffline;
RENAME TABLE jiveOffline2 TO jiveOffline;
ALTER TABLE jiveOffline ADD CONSTRAINT jiveOffline_pk PRIMARY KEY (username, messageID);

-- Rename column
CREATE TABLE jiveVCard2 (
  username              VARCHAR(64)     NOT NULL,
Daniel Henninger's avatar
Daniel Henninger committed
37
  vcard                 VARCHAR(2000)   NOT NULL
38 39 40 41 42 43 44 45 46 47 48 49 50 51
);

INSERT INTO jiveVCard2 (username, vcard)
SELECT username, value FROM jiveVCard;

DROP TABLE jiveVCard;
RENAME TABLE jiveVCard2 TO jiveVCard;
ALTER TABLE jiveVCard ADD CONSTRAINT jiveVCard_pk PRIMARY KEY (username);

-- Rename column
CREATE TABLE jivePrivate2 (
  username              VARCHAR(64)     NOT NULL,
  name                  VARCHAR(100)    NOT NULL,
  namespace             VARCHAR(200)    NOT NULL,
Daniel Henninger's avatar
Daniel Henninger committed
52
  privateData           VARCHAR(2000)   NOT NULL
53 54
);

Daniel Henninger's avatar
Daniel Henninger committed
55 56
INSERT INTO jivePrivate2 (username, name, namespace, privateData)
SELECT username, name, namespace, value FROM jivePrivate;
57

Daniel Henninger's avatar
Daniel Henninger committed
58 59 60
DROP TABLE jivePrivate;
RENAME TABLE jivePrivate2 TO jivePrivate;
ALTER TABLE jivePrivate ADD CONSTRAINT jivePrivate_pk PRIMARY KEY (username);
61 62 63 64 65 66 67 68 69

-- Rename column
CREATE TABLE jiveUser2 (
  username              VARCHAR(64)     NOT NULL,
  plainPassword         VARCHAR(32),
  encryptedPassword     VARCHAR(255),
  name                  VARCHAR(100),
  email                 VARCHAR(100),
  creationDate          CHAR(15)        NOT NULL,
Daniel Henninger's avatar
Daniel Henninger committed
70
  modificationDate      CHAR(15)        NOT NULL
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
);

INSERT INTO jiveUser2 (username, plainPassword, encryptedPassword, name, email, creationDate, modificationDate)
SELECT username, password, encryptedPassword, name, email, creationDate, modificationDate FROM jiveUser;

DROP TABLE jiveUser;
RENAME TABLE jiveUser2 TO jiveUser;
ALTER TABLE jiveUser ADD CONSTRAINT jiveUser_pk PRIMARY KEY (username);
CREATE INDEX jiveUsr_cDate_idx ON jiveUser (creationDate ASC);

-- Rename column
CREATE TABLE mucRoom2 (
  roomID              INTEGER       NOT NULL,
  creationDate        CHAR(15)      NOT NULL,
  modificationDate    CHAR(15)      NOT NULL,
  name                VARCHAR(50)   NOT NULL,
  naturalName         VARCHAR(255)  NOT NULL,
  description         VARCHAR(255),
  lockedDate          CHAR(15)      NOT NULL,
  emptyDate           CHAR(15),
  canChangeSubject    INTEGER       NOT NULL,
  maxUsers            INTEGER       NOT NULL,
  publicRoom          INTEGER       NOT NULL,
  moderated           INTEGER       NOT NULL,
  membersOnly         INTEGER       NOT NULL,
  canInvite           INTEGER       NOT NULL,
  roomPassword        VARCHAR(50),
  canDiscoverJID      INTEGER       NOT NULL,
  logEnabled          INTEGER       NOT NULL,
  subject             VARCHAR(100),
  rolesToBroadcast    INTEGER       NOT NULL,
  useReservedNick     INTEGER       NOT NULL,
  canChangeNick       INTEGER       NOT NULL,
Daniel Henninger's avatar
Daniel Henninger committed
104
  canRegister         INTEGER       NOT NULL
105 106 107 108 109 110 111 112 113 114 115 116 117
);

INSERT INTO mucRoom2 (roomID, creationDate, modificationDate, name, naturalName, description, lockedDate, emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, canInvite, roomPassword, canDiscoverJID, logEnabled, subject, rolesToBroadcast, useReservedNick, canChangeNick, canRegister)
SELECT roomID, creationDate, modificationDate, name, naturalName, description, lockedDate, emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, canInvite, password, canDiscoverJID, logEnabled, subject, rolesToBroadcast, useReservedNick, canChangeNick, canRegister FROM mucRoom;

DROP TABLE mucRoom;
RENAME TABLE mucRoom2 TO mucRoom;
ALTER TABLE mucRoom ADD CONSTRAINT mucRoom_pk PRIMARY KEY (name);
CREATE INDEX mucRm_roomid_idx ON mucRoom (roomID);

UPDATE jiveVersion set version=13 where name = 'openfire';