Difference between revisions of "Migrating from 6.2.5 to 6.3"

From OpenKM Documentation
Jump to: navigation, search
m
Line 39: Line 39:
  
 
* The ExecuteScription action SQL insert has changed between version 6.2.x to 6.X please take a look at [[Enable automation]] see how column with older value '''textarea''' now must have value '''code'''.
 
* The ExecuteScription action SQL insert has changed between version 6.2.x to 6.X please take a look at [[Enable automation]] see how column with older value '''textarea''' now must have value '''code'''.
 +
 +
* Due change in way how some special characters like '&' are stored now in repository is necessary execute this script. Go to Administration,  Scripting and execute it.
 +
<source lang="java">
 +
import com.openkm.dao.bean.*;
 +
import com.openkm.dao.*;
 +
import com.openkm.util.*;
 +
import org.hibernate.*;
 +
 +
String qs = "from NodeBase nb where nb.name like '%&%' and nb.uuid NOT IN (select nb.uuid from NodeBase nb where nb.name like '%&amp;%')";
 +
Session session = null;
 +
Transaction tx = null;
 +
 +
try {
 +
    session = HibernateUtil.getSessionFactory().openSession();
 +
    tx = session.beginTransaction();
 +
    Query q = session.createQuery(qs);
 +
   
 +
    for (NodeBase nBase : q.list()) {
 +
      print(nBase.getUuid() + " -> " + nBase.getName() + "<br>");
 +
      nBase.setName(PathUtils.encodeEntities(nBase.getName()));
 +
      session.update(nBase);
 +
    }
 +
   
 +
    HibernateUtil.commit(tx);
 +
} catch (Exception e) {
 +
    HibernateUtil.rollback(tx);
 +
    e.printStackTrace();
 +
} finally {
 +
    HibernateUtil.close(session);
 +
}
 +
</source>
  
 
* Enjoy OpenKM 6.3.0!
 
* Enjoy OpenKM 6.3.0!

Revision as of 10:00, 14 July 2014


Nota advertencia.png There's a problem when you update a table adding a new column with a "not null" constraint, if the table already has some rows. With MySQL and PostgreSQL can be solved connecting directly to your database. With HSQL - which is an embeded database - we suggest going to OpenKM go to Administration > Database Query and execute the database update.

  • Make a backup!!!
  • Stop Tomcat
  • Edit OpenKM.cfg and set hibernate.hbm2ddl to update
  • Replace the OpenKM.war
  • Go to Administration > Crontab and delete "User Items Serialize" and "Refresh User Items" tasks.
  • Run from your preferred SQL client these queries:

MySQL

ALTER TABLE OKM_MIME_TYPE ADD COLUMN MT_SEARCH char(1);
UPDATE OKM_MIME_TYPE SET MT_SEARCH='T';
ALTER TABLE OKM_MIME_TYPE MODIFY COLUMN MT_SEARCH char(1) NOT NULL;

PostgreSQL

ALTER TABLE OKM_MIME_TYPE ADD COLUMN MT_SEARCH char(1);
UPDATE OKM_MIME_TYPE SET MT_SEARCH='T';
ALTER TABLE OKM_MIME_TYPE ALTER COLUMN MT_SEARCH SET NOT NULL;
  • Start Tomcat again
  • Go to Administration > Database Query, and execute:

HSQL

ALTER TABLE OKM_MIME_TYPE ADD COLUMN MT_SEARCH char(1);
UPDATE OKM_MIME_TYPE SET MT_SEARCH='T';
ALTER TABLE OKM_MIME_TYPE ALTER COLUMN MT_SEARCH SET NOT NULL;
  • The ExecuteScription action SQL insert has changed between version 6.2.x to 6.X please take a look at Enable automation see how column with older value textarea now must have value code.
  • Due change in way how some special characters like '&' are stored now in repository is necessary execute this script. Go to Administration, Scripting and execute it.
import com.openkm.dao.bean.*;
import com.openkm.dao.*;
import com.openkm.util.*;
import org.hibernate.*;
 
String qs = "from NodeBase nb where nb.name like '%&%' and nb.uuid NOT IN (select nb.uuid from NodeBase nb where nb.name like '%&amp;%')";
Session session = null;
Transaction tx = null;
 
try {
    session = HibernateUtil.getSessionFactory().openSession();
    tx = session.beginTransaction();
    Query q = session.createQuery(qs);
     
    for (NodeBase nBase : q.list()) {
       print(nBase.getUuid() + " -> " + nBase.getName() + "<br>");
       nBase.setName(PathUtils.encodeEntities(nBase.getName()));
       session.update(nBase);
    }
     
    HibernateUtil.commit(tx);
} catch (Exception e) {
    HibernateUtil.rollback(tx);
    e.printStackTrace();
} finally {
    HibernateUtil.close(session);
}
  • Enjoy OpenKM 6.3.0!

If you have any weird problem try to stop Tomcat, delete these folders:

  • $TOMCAT_HOME/webapps/OpenKM
  • $TOMCAT_HOME/work/Catalina/localhost

And start Tomcat again.


Nota clasica.png Recommended to clear browser cache and Java Plugin cache