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.
- Export the existing data using the 1.2.x version of the portlet
- Import the saved data using the 2.0.0+ version of the portlet
- Update the version of the portlet you are deploying. Also update from log4j to loback for logging.
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.
Modify src/main/resources/hibernate.properties to refer to your current database. Refer to the values in your uPortal filters/<environment>.properties file.
From the root of the SimpleContentPortlet source, export the existing data.
Checkout the latest version of the SimpleContentPortlet
IF you have negative sequence ID values, possible on at least Oracle and PostgreSQL databases exhibiting issue CMSPLT-54 - Attachment uploads fail with PostgreSQL 9.3 Resolved
- Using your database tools, back up the tables SCM_ATTACHMENT and sequence UP_ATTACHMENT_SEQ
Drop tables SCM_ATTACHMENT and sequence UP_ATTACHMENT_SEQ
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).
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.
- (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.
Deploy your uPortal (ant deploy-ear). Test and insure you are able to view the existing attachments, and can upload and view new attachments.
- (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.