Migrating from 6.3 to 7.0
Overview
Section titled “Overview”This guide describes how to migrate from OpenKM CE 6.3 to OpenKM CE 7.0. It’s a major migration, not an update: OpenKM 7.0 stores the repository in a different database structure, so the data is copied from the 6.3 installation into a new 7.0 installation.
OpenKM 6.3 only receives security fixes, so migrating to 7.0 is recommended.
Why this is a major migration
Section titled “Why this is a major migration”OpenKM 7.0 changes how data is stored and versioned:
- Node versioning also tracks metadata changes, not only the document content: any change in the metadata of a node creates a new version.
- Each metadata group is stored in two tables of its own (current values and history), instead of the name-value table of 6.3.
- Because of these changes, the Updater utility can’t take a 6.3 installation to 7.0.
There are two ways to migrate:
- Database import (recommended): OpenKM 7.0 reads the 6.3 database directly and copies everything in a single run, including users, passwords, permissions and bookmarks. It requires OpenKM 7.0.6 or later.
- Repository export and import: export each part of the repository to disk from 6.3 and import it in 7.0. It doesn’t migrate users, roles or bookmarks.
Migration with Database import
Section titled “Migration with Database import”What is migrated
Section titled “What is migrated”- Folders, documents with all their versions (author, date and comment of each one), mails and their attachments.
- The repository roots:
okm:root,okm:categories,okm:templates,okm:personal(the personal folders of each user),okm:mailandokm:trash. - Keywords, categories, notes, metadata values, user and role permissions, subscriptions and locks.
- Users and roles, with their passwords: users log in to 7.0 with the same password they had in 6.3.
- Bookmarks.
Not migrated:
okmAdminalready exists in 7.0 and keeps its 7.0 password.okm:thesaurus, which doesn’t exist in 7.0.- The permissions of the repository roots themselves (
okm:root,okm:categories…): the 7.0 ones are kept. - The configuration (Administration > Configuration), profiles, automation rules, crontab tasks, mail accounts and reports, which must be set up again in 7.0.
- Documents that OpenKM 6.3 keeps in its database instead of on disk (
repository.datastore.backend=db).
Before you start
Section titled “Before you start”- OpenKM 7.0.6 or later, freshly installed and running. Don’t use it before the migration: the import is meant for an empty repository.
- Access from the 7.0 server to the 6.3 database: its JDBC URL (it’s in the
jdbc/OpenKMDSresource of the 6.3 Tomcatconf/server.xml), a user with read access and its password. If the database is on another server, it must accept connections from the 7.0 server. - Access from the 7.0 server to the 6.3 datastore, the folder where 6.3 keeps the document files, usually
<6.3 Tomcat>/repository/datastore. It can be the same folder if both are installed on the same server, a network mount, or a copy. - The metadata groups of 6.3. You can see their XML definition in the 6.3 Administration > Metadata, or in the
PropertyGroups.xmlfile of the 6.3 Tomcat folder.
Preliminary check
Section titled “Preliminary check”Before migrating, run the following two checks on the OpenKM 6.3 database. Both are read-only queries.
Length of metadata values
Section titled “Length of metadata values”In 6.3, metadata field values are stored in a column with no length restriction. In 7.0, each field is a column with a maximum size: 128 characters for Input, Select and SuggestBox, and 256 for TextArea. If a 6.3 value exceeds the size of its 7.0 column, it can’t be imported.
Run the query for your database engine to get the maximum stored length of each metadata field:
MySQL / MariaDB
SELECT NPG_GROUP, NPG_NAME, MAX(LENGTH(NPG_VALUE))FROM OKM_NODE_PROPERTYGROUP BY NPG_GROUP, NPG_NAME;PostgreSQL
SELECT NPG_GROUP, NPG_NAME, MAX(LENGTH(NPG_VALUE))FROM OKM_NODE_PROPERTYGROUP BY NPG_GROUP, NPG_NAME;Oracle
SELECT NPG_GROUP, NPG_NAME, MAX(LENGTH(NPG_VALUE))FROM OKM_NODE_PROPERTYGROUP BY NPG_GROUP, NPG_NAME;SQL Server
SELECT NPG_GROUP, NPG_NAME, MAX(LEN(NPG_VALUE))FROM OKM_NODE_PROPERTYGROUP BY NPG_GROUP, NPG_NAME;Compare each result with the default size of its field type. If any field exceeds it, increase its size with the dbColumnSize attribute in the XML definition of the metadata group, before registering it in 7.0 (Step 1). The default sizes and the use of the attribute are explained in How metadata is stored into OpenKM.
Duplicated node names under the same parent
Section titled “Duplicated node names under the same parent”A folder can’t contain two nodes with the same name. This query counts the collisions and must return 0:
SELECT COUNT(*)FROM ( SELECT NBS_PARENT, NBS_NAME FROM OKM_NODE_BASE GROUP BY NBS_PARENT, NBS_NAME HAVING COUNT(*) > 1) T;The query is valid on MySQL / MariaDB, PostgreSQL, Oracle and SQL Server.
Step 1 — Register the metadata groups in OpenKM 7.0
Section titled “Step 1 — Register the metadata groups in OpenKM 7.0”If OpenKM 6.3 used metadata groups, register them in 7.0 before importing, with the same group and field names. If a node has a metadata group that isn’t registered, the import stops with “Unknown property group”.
- Log in to OpenKM 7.0 as
okmAdminand go to Administration > Metadata. - Create each metadata group with its XML definition from 6.3. The format is the same (see Metadata XML definition).
- Enable the groups in the corresponding profiles so that users can see them.
Step 2 — Import from the 6.3 database
Section titled “Step 2 — Import from the 6.3 database”Go to Administration > Utilities > Database import and fill in the form:
| Field | Value |
|---|---|
| DB URL | JDBC URL of the 6.3 database, for example jdbc:mariadb://localhost:3306/okmdb. |
| DB user / DB password | User and password of the 6.3 database. |
| Source folder / Destination folder | Leave them empty. |
| Source datastore | Path to the 6.3 datastore folder as seen from the 7.0 server, for example /opt/openkm-6.3/tomcat/repository/datastore. |
| Thread pool size | Leave the default value. |
| Source tenant ID | Leave it empty. |
| Nodes, All repository roots, Users and roles, Bookmarks | Checked. |
| Node relations and the Concurrent options | Unchecked. |
Click on the Import button and wait. When it finishes, it shows “Import finished with N errors”. The details, and the reason of each error, are in the DatabaseImporter log in the 7.0 Tomcat logs folder.
Step 3 — After the import
Section titled “Step 3 — After the import”- Rebuild the search indexes, so that the imported documents and their content can be found.
- Check the result:
- The folder structure and a sample of documents, with their versions, metadata, categories and keywords.
- The personal folders of some users.
- Log in with a migrated user and their 6.3 password.
- Redo the configuration that isn’t migrated (configuration parameters, profiles, automation, crontab tasks, mail accounts…).
Users log in with their 6.3 password. OpenKM 6.3 stored it as an MD5 hash: 7.0 accepts it and replaces it with a BCrypt hash the first time each user logs in.
When everything is correct, stop OpenKM 6.3 and keep its backup.
Alternative: repository export and import
Section titled “Alternative: repository export and import”Use this method when OpenKM 7.0 can’t reach the 6.3 database. It migrates folders, documents with their versions, keywords, categories, notes and metadata, but not users, roles or bookmarks, which must be created again in 7.0.
Step 1 — Export the repository from OpenKM 6.3
Section titled “Step 1 — Export the repository from OpenKM 6.3”In the OpenKM 6.3 administration, go to Repository Export and repeat the export for each repository node:
| Repository node | Description |
|---|---|
| okm:root | Main document repository: all folders and documents. |
| okm:categories | Category taxonomy applied to documents. |
| okm:templates | Document templates. |
| okm:personal | Personal folders of each user. |
| okm:mail | Mail archive. |
| okm:trash | Deleted items (include it if they may need to be recovered). |
For each node:
- Source path: the repository node to export (for example,
okm:root). - Destination folder: a folder on the 6.3 server with enough free space for all the exported content.
- Check Metadata and History.
- Click on the Export button and wait until it finishes.
Step 2 — Transfer the exported data to the 7.0 server
Section titled “Step 2 — Transfer the exported data to the 7.0 server”Copy the exported folders to the OpenKM 7.0 server (SCP, SFTP, a network mount…), keeping their structure as it is, and write down their paths for step 4.
Step 3 — Register the metadata groups in OpenKM 7.0
Section titled “Step 3 — Register the metadata groups in OpenKM 7.0”The same as step 1 of the database import. Create the users and roles in 7.0 too, so that the imported permissions apply to them.
Step 4 — Import the repository into OpenKM 7.0
Section titled “Step 4 — Import the repository into OpenKM 7.0”In the OpenKM 7.0 administration, go to Utilities > Repository import and repeat the import for each exported node:
- Source folder: the folder with the exported data of this node.
- Repository path: the matching path in 7.0 (for example,
/okm:root). - Type: Full.
- Click on the Import button and wait until it finishes before importing the next node.
Then rebuild the search indexes and check the result as described in After the import.