Difference between revisions of "Migration from 5.0.4 to 5.1.8"

From OpenKM Documentation
Jump to: navigation, search
(Created page with '{{Warning|This migration process is under alfa state.}} Change table columns definition: <source lang="sql"> ALTER TABLE OKM_MAIL_ACCOUNT MODIFY COLUMN MA_ACTIVE char(1) NOT NU…')
 
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Warning|This migration process is under alfa state.}}
+
{{TOCright}} __TOC__
  
Change table columns definition:
+
{{Note|In OpenKM 5.1.x the configuration is managed from Administration and stored in database, so most of the configuration in OpenKM.cfg from OpenKM 5.0 is not valid and should be migrated. Only database related stuff like '''hibernate.dialect''' and '''hibernate.hbm2ddl''' makes sense in OpenKM 5.1.x configuration file.}}
  
 +
== Changes ==
 +
'''com.openkm.extractor.TiffTextExtractor''' has been deprecated, so you need to edit the '''repository.xml''' and '''repository/workspaces/default/workspace.xml''' files and change by one of these options:
 +
 +
* com.openkm.extractor.AbbyTextExtractor
 +
* com.openkm.extractor.CuneiformTextExtractor
 +
* com.openkm.extractor.Tesseract2TextExtractor
 +
* com.openkm.extractor.Tesseract3TextExtractor
 +
 +
See also [[Third-party_software_integration: OCR]].
 +
 +
== OpenKM 5.0 stuff ==
 +
* Make a backup!
 +
* Log into OpenKM 5.0 and go to '''Administration''' > '''Database query''' and execute these sentences in order to export users and roles:
 +
 +
=== Hypersonic ===
 
<source lang="sql">
 
<source lang="sql">
ALTER TABLE OKM_MAIL_ACCOUNT MODIFY COLUMN MA_ACTIVE char(1) NOT NULL;
+
SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''' + USR_ID + ''', ''' + USR_NAME + ''', ''' + USR_PASSWORD + ''', ''' + USR_EMAIL + ''', ''' + CASEWHEN(USR_ACTIVE,'T', 'F') + ''');' from OKM_USER;
ALTER TABLE OKM_QUERY_PARAMS MODIFY COLUMN QP_DASHBOARD char(1) NOT NULL;
+
SELECT 'INSERT INTO OKM_ROLE (ROL_ID, ROL_ACTIVE) VALUES (''' + ROL_ID + ''', ''' + CASEWHEN(ROL_ACTIVE, 'T', 'F') + ''');' from OKM_ROLE;
ALTER TABLE OKM_ROLE MODIFY COLUMN ROL_ACTIVE char(1) NOT NULL;
+
SELECT 'INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''' + UR_USER + ''', ''' + UR_ROLE + ''');' FROM OKM_USER_ROLE;
ALTER TABLE OKM_TWITTER_ACCOUNT MODIFY COLUMN TA_ACTIVE char(1) NOT NULL;
 
ALTER TABLE OKM_USER MODIFY COLUMN USR_ACTIVE char(1) NOT NULL;
 
ALTER TABLE OKM_ACTIVITY MODIFY COLUMN ACT_ITEM varchar(127) NULL;
 
ALTER TABLE OKM_REPORT MODIFY COLUMN RP_ACTIVE char(1) NOT NULL;
 
ALTER TABLE OKM_CRON_TAB MODIFY COLUMN CT_ACTIVE char(1) NOT NULL;
 
 
</source>
 
</source>
  
Rename table columns:
+
=== MySQL ===
 
 
 
<source lang="sql">
 
<source lang="sql">
ALTER TABLE OKM_EXTENSION CHANGE COLUMN EX_DESCRIPTION EXT_NAME varchar(255) NOT NULL;
+
SELECT CONCAT('INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''', USR_ID, ''', ''', USR_NAME, ''', ''', USR_PASSWORD, ''', ''', USR_EMAIL, ''', ''', IF(USR_ACTIVE IS TRUE,'T', 'F'), ''');') from OKM_USER;
ALTER TABLE OKM_EXTENSION CHANGE COLUMN EX_UUID EXT_UUID varchar(127) NOT NULL;
+
SELECT CONCAT('INSERT INTO OKM_ROLE (ROL_ID, ROL_ACTIVE) VALUES (''', ROL_ID, ''', ''', IF(ROL_ACTIVE IS TRUE, 'T', 'F'), ''');') from OKM_ROLE;
 +
SELECT CONCAT('INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''', UR_USER, ''', ''', UR_ROLE, ''');') from OKM_USER_ROLE;
 
</source>
 
</source>
  
Remove deprecated table columns:
+
=== PostgreSQL ===
 +
<source lang="sql">
 +
SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''' || USR_ID || ''', ''' || USR_NAME || ''', ''' || USR_PASSWORD || ''', ''' || USR_EMAIL || ''', ''' || CASE WHEN USR_ACTIVE=1 THEN 'T' ELSE 'F' END || ''');' from OKM_USER;
 +
SELECT 'INSERT INTO OKM_ROLE (ROL_ID, ROL_ACTIVE) VALUES (''' || ROL_ID || ''', ''' || CASE WHEN ROL_ACTIVE=1 THEN 'T' ELSE 'F' END || ''');' from OKM_ROLE;
 +
SELECT 'INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''' || UR_USER || ''', ''' || UR_ROLE || ''');' from OKM_USER_ROLE;</source>
  
 +
=== Oracle ===
 
<source lang="sql">
 
<source lang="sql">
ALTER TABLE OKM_BOOKMARK DROP COLUMN BM_PATH;
+
SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''' || USR_ID || ''', ''' || USR_NAME || ''', ''' || USR_PASSWORD || ''', ''' || USR_EMAIL || ''', ''' || DECODE(USR_ACTIVE, 1, 'T', 'F') || ''');' from OKM_USER;
ALTER TABLE OKM_REPORT DROP COLUMN RP_TYPE;
+
SELECT 'INSERT INTO OKM_ROLE (ROL_ID, ROL_ACTIVE) VALUES (''' || ROL_ID || ''', ''' || DECODE(ROL_ACTIVE, 1, 'T', 'F') || ''');' from OKM_ROLE;
ALTER TABLE OKM_CRON_TAB DROP COLUMN CT_TYPE;
+
SELECT 'INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''' || UR_USER || ''', ''' || UR_ROLE || ''');' from OKM_USER_ROLE;</source>
</source>
+
 
 +
* Copy the output of these sentences to a secure place.
 +
* Stop JBoss.
 +
 
 +
== OpenKM 5.1 stuff ==
 +
* Stop JBoss.
 +
* Copy or move the '''$JBOSS_50_HOME/repository.xml''' file and '''$JBOSS_50_HOME/repository''' directory to '''$JBOSS_51_HOME'''
 +
* Change '''$JBOSS_51_HOME/server/default/conf/login-config.xml''' according to those changes made at '''$JBOSS_50_HOME/server/default/conf/login-config.xml''', if any. Maybe you don't need to do this because didn't change anything in the OpenKM 5.0.x installation.
 +
* Change '''hibernate.hbm2ddl=none''' to '''hibernate.hbm2ddl=create''' in '''OpenKM.cfg'''; otherwise, the translation table won't be created, which results in an "Error getting translations: English translation is mandatory and can not be deleted" error message.
 +
* Start JBoss.
 +
* Log into OpenKM 5.1 and go to '''Administration''' > '''Database query''' and execute the output of the previous stored SQL sentences.
 +
* Now your users and roles from the old OpenKM 5.0.4 has been restored in OpenKM 5.1.8
 +
* Change '''hibernate.hbm2ddl=create''' to '''hibernate.hbm2ddl=none''' in '''OpenKM.cfg'''
 +
 
 +
[[Category: Migration Guide]]

Latest revision as of 14:04, 27 August 2012


Nota clasica.png In OpenKM 5.1.x the configuration is managed from Administration and stored in database, so most of the configuration in OpenKM.cfg from OpenKM 5.0 is not valid and should be migrated. Only database related stuff like hibernate.dialect and hibernate.hbm2ddl makes sense in OpenKM 5.1.x configuration file.

Changes

com.openkm.extractor.TiffTextExtractor has been deprecated, so you need to edit the repository.xml and repository/workspaces/default/workspace.xml files and change by one of these options:

  • com.openkm.extractor.AbbyTextExtractor
  • com.openkm.extractor.CuneiformTextExtractor
  • com.openkm.extractor.Tesseract2TextExtractor
  • com.openkm.extractor.Tesseract3TextExtractor

See also Third-party_software_integration: OCR.

OpenKM 5.0 stuff

  • Make a backup!
  • Log into OpenKM 5.0 and go to Administration > Database query and execute these sentences in order to export users and roles:

Hypersonic

SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''' + USR_ID + ''', ''' + USR_NAME + ''', ''' + USR_PASSWORD + ''', ''' + USR_EMAIL + ''', ''' + CASEWHEN(USR_ACTIVE,'T', 'F') + ''');' from OKM_USER;
SELECT 'INSERT INTO OKM_ROLE (ROL_ID, ROL_ACTIVE) VALUES (''' + ROL_ID + ''', ''' + CASEWHEN(ROL_ACTIVE, 'T', 'F') + ''');' from OKM_ROLE;
SELECT 'INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''' + UR_USER + ''', ''' + UR_ROLE + ''');' FROM OKM_USER_ROLE;

MySQL

SELECT CONCAT('INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''', USR_ID, ''', ''', USR_NAME, ''', ''', USR_PASSWORD, ''', ''', USR_EMAIL, ''', ''', IF(USR_ACTIVE IS TRUE,'T', 'F'), ''');') from OKM_USER;
SELECT CONCAT('INSERT INTO OKM_ROLE (ROL_ID, ROL_ACTIVE) VALUES (''', ROL_ID, ''', ''', IF(ROL_ACTIVE IS TRUE, 'T', 'F'), ''');') from OKM_ROLE;
SELECT CONCAT('INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''', UR_USER, ''', ''', UR_ROLE, ''');') from OKM_USER_ROLE;

PostgreSQL

SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''' || USR_ID || ''', ''' || USR_NAME || ''', ''' || USR_PASSWORD || ''', ''' || USR_EMAIL || ''', ''' || CASE WHEN USR_ACTIVE=1 THEN 'T' ELSE 'F' END || ''');' from OKM_USER;
SELECT 'INSERT INTO OKM_ROLE (ROL_ID, ROL_ACTIVE) VALUES (''' || ROL_ID || ''', ''' || CASE WHEN ROL_ACTIVE=1 THEN 'T' ELSE 'F' END || ''');' from OKM_ROLE;
SELECT 'INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''' || UR_USER || ''', ''' || UR_ROLE || ''');' from OKM_USER_ROLE;

Oracle

SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''' || USR_ID || ''', ''' || USR_NAME || ''', ''' || USR_PASSWORD || ''', ''' || USR_EMAIL || ''', ''' || DECODE(USR_ACTIVE, 1, 'T', 'F') || ''');' from OKM_USER;
SELECT 'INSERT INTO OKM_ROLE (ROL_ID, ROL_ACTIVE) VALUES (''' || ROL_ID || ''', ''' || DECODE(ROL_ACTIVE, 1, 'T', 'F') || ''');' from OKM_ROLE;
SELECT 'INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''' || UR_USER || ''', ''' || UR_ROLE || ''');' from OKM_USER_ROLE;
  • Copy the output of these sentences to a secure place.
  • Stop JBoss.

OpenKM 5.1 stuff

  • Stop JBoss.
  • Copy or move the $JBOSS_50_HOME/repository.xml file and $JBOSS_50_HOME/repository directory to $JBOSS_51_HOME
  • Change $JBOSS_51_HOME/server/default/conf/login-config.xml according to those changes made at $JBOSS_50_HOME/server/default/conf/login-config.xml, if any. Maybe you don't need to do this because didn't change anything in the OpenKM 5.0.x installation.
  • Change hibernate.hbm2ddl=none to hibernate.hbm2ddl=create in OpenKM.cfg; otherwise, the translation table won't be created, which results in an "Error getting translations: English translation is mandatory and can not be deleted" error message.
  • Start JBoss.
  • Log into OpenKM 5.1 and go to Administration > Database query and execute the output of the previous stored SQL sentences.
  • Now your users and roles from the old OpenKM 5.0.4 has been restored in OpenKM 5.1.8
  • Change hibernate.hbm2ddl=create to hibernate.hbm2ddl=none in OpenKM.cfg