Upgrading from 1.2.x or prior to 2.0.0

Overview

The data representation of attachments (which is a part of the SimpleContentPortlet) changed from a Base64-encoded text field in v1.2.x and prior to a BLOB column in v2.0.0.  Users of v1.2.x and prior must do the following procedure to export the data from the attachments tables, then re-import it with v2.0.0 or later to migrate the prior attachment data into the BLOB column.  Also with v2.0.0 the logging was changed from log4j (log4j.properties) to logback (logback.xml) so you will need to update your uportal-portlets-overlay/SimpleContentPortlet accordingly.

General steps:

  1. Export the existing data using the 1.2.x version of the portlet
  2. Import the saved data using the 2.0.0+ version of the portlet
  3. Update the version of the portlet you are deploying. Also update from log4j to loback for logging.

Migration steps

  1. Clone the SimpleContentPortlet from https://github.com/Jasig/SimpleContentPortlet. You can do this on your target system (e.g. production) or on a system that has access to the target (e.g. production) database.

    git clone https://github.com/Jasig/SimpleContentPortlet.git
    # Get the latest 1.2.x version
    checkout rel-1-2-patches
  2. Modify src/main/resources/hibernate.properties to refer to your current database.  Refer to the values in your uPortal filters/<environment>.properties file.

    src/main/resources/hibernate.properties
    # Revise to refer to your current database
    hibernate.connection.driver_class=org.hsqldb.jdbc.JDBCDriver
    hibernate.connection.url=jdbc:hsqldb:mem:simplecontent
    hibernate.connection.username=sa
    hibernate.connection.password=
    hibernate.dialect=org.hibernate.dialect.HSQLDialect
    hibernate.connection.validationQuery=select 1 from INFORMATION_SCHEMA.SYSTEM_USERS
    
    
  3. From the root of the SimpleContentPortlet source, export the existing data.

    mvn clean package -Ddir=<directoryToSaveAttachmentsTo> data-export
  4. Checkout the latest version of the SimpleContentPortlet

    git checkout master
  5. IF you have negative sequence ID values, possible on at least Oracle and PostgreSQL databases exhibiting issue  CMSPLT-54 - Getting issue details... STATUS

    1. Using your database tools, back up the tables SCM_ATTACHMENT and sequence UP_ATTACHMENT_SEQ
    2. Drop tables SCM_ATTACHMENT and sequence UP_ATTACHMENT_SEQ

      select count(0) from SCM_ATTACHMENT where id < 1;
      -- IF result is > 0, then drop the attachment table and sequence
      drop table SCM_ATTACHMENT;
      drop sequence UP_ATTACHMENT_SEQ;
  6. From the root of the SimpleContentPortlet source, import the exported data.  The database column will be created if it is not already present (if the new portlet is deployed to uPortal, that will also create the new column).

    mvn clean package -Ddir=<directoryToSaveAttachmentsTo> data-import
  7. Update your uPortal pom.xml to use the latest released 2.0.0+ version (see http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jasig.portlet.simplecontent%22 for latest version).  Alternately for steps 7 and 8 you can cherry-pick https://github.com/Jasig/uPortal/commit/afeb7366caf02f607066f752158f1aa3bae47cd0.

    <SimpleContentPortlet.version>2.0.1</SimpleContentPortlet.version>
  8. (within uPortal) Update your uportal-portlets-overlay/SimpleContentPortlet to switch from log4j.properties to loback.xml by putting this logback.xml into uportal-portlets-overlay/SimpleContentPortlet/src/main/resources.  With uPortal master, the uportal-portlets-overlay/SimpleContentPortlet/pom.xml already includes filtering logback.xml as part of the maven build process.  Also delete uportal-portlets-overlay/SimpleContentPortlet/src/main/resources/log4j.properties.
  9. Deploy your uPortal (ant deploy-ear).  Test and insure you are able to view the existing attachments, and can upload and view new attachments.

    Insure on your target server that <tomcatHome>/webapps/SimpleContentPortlet/content is empty before performing your test of accessing existing attachments. That directory is the location the portlet hydrates files from the database onto the hard disk to avoid database accesses for subsequent attachment accesses. The directory should be empty as a result of deploying the portlet. If there are remaining files in the directory, these will be served instead of accessing the database and you may have a false sense that the export/import worked correctly when it had not.

    Also clear your browser cache to insure content is not served from the browser's local cache.

  10. (optional but recommended) Drop the extraneous column SCM_ATTACHMENTS.DATA.  This column held the Base64-encoded version of the attachments, but is now replaced by the column BDATA.