How to migrate Omeka_S 2.0.2 on Server A to Omeka_S 4.04 on Server B?

We’re setting up a new Omeka S 4.04 installation on a new server, but would like to migrate our old data from the 2.02 site/server.

Steps:

  • Omeka 4.04 is running on the new server
  • I had the site admin enter the initial data (Create the first user etc.)
  • I transferred our custom theme from the old to the new server
  • I ran mysqldump on the old server to get a SQL copy of the old Omeka 2.0.2 database
  • Copied the SQL dump file to the new server, and
  • $ mysql -u root -p omeka_s < omeka_s_db_2023-11-07.sql

(I changed the name of the database from the old host, but I don’t think this matters.)

After this, when migrating to the site page I get some message about needing to upgrade SQL. After clicking on the “Upgrade SQL” button, I get an error message. Switching to development/debug mode as per this page: Retrieving Error Messages - Omeka S User Manual

I get errors like this:

Doctrine\DBAL\Exception\TableExistsException
An exception occurred while executing 'CREATE TABLE value_annotation (id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;': SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'value_annotation' already exists

Details:

PDOException: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'value_annotation' already exists in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:141
Stack trace:
#0 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(141): PDO->query()
#1 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOQueryImplementation.php(24): Doctrine\DBAL\Driver\PDOConnection->doQuery()

comparing the tables in the new (4.04) and old (2.0.2) databases; it looks like the 4.04 database has some tables that weren’t present in 2.0.2.

Obviously I’m doing this wrong, but is there a right way to accomplish this migration? I couldn’t find any documentation on this.

Thanks

I forgot to add that I also copied over the contents of the ~/files directory from the old to the new Omeka server.

So you installed Omeka S 4.0.4 completely on the new server, then loaded in the dump from the old one?

That would lead to the kind of problem you’ve shown in the error message here. By doing things that way, your database before running the upgrade is a mixture of tables from 2.0.2 (from the dump) and 4.0.4 (any tables that Omeka S introduced after 2.0.2). What you want to do is just have the files for the 4.0.4 version on the new server, but you don’t want to actually run the installer on the new server and have it create the database.

Instead, you just want to load in the dump of the old database into a completely blank database on the new server. From the situation you have now, what you’d want to do is clear out the omeka_s database so it has no tables (you could also drop the whole database and recreate it, or create a new database and use that one instead). Then you load in the 2.0.2 dump and access the site, and you should be prompted to upgrade.

OK, restoring the mysql dump file from the old server before doing anything else worked; at least as far as the SQL update is concerned. Now it’s complaining that the theme is for an out of date version of Omeka:

# Omeka S encountered an error

**Exception**
The current theme is not active. Its current state is "invalid_omeka_version".

Details:

Exception: The current theme is not active. Its current state is "invalid_omeka_version". in /var/www/html/application/src/Mvc/MvcListeners.php:329 Stack trace: #0 /var/www/html/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Omeka\Mvc\MvcListeners->preparePublicSite() #1 /var/www/html/vendor/laminas/laminas-eventmanager/src/EventManager.php(179): Laminas\EventManager\EventManager->triggerListeners() #2 /var/www/html/vendor/laminas/laminas-mvc/src/Application.php(304): Laminas\EventManager\EventManager->triggerEventUntil() #3 /var/www/html/index.php(21): Laminas\Mvc\Application->run() #4 {main}

I’m not the theme writer, so will need to dig into the documentation to see how to fix this.

Thanks for your help with this, John!