I need to make many changes to my items by importing a TSV and I want to do a dry run on another installation on another server. I have Item sets, custom vocabs, resource templates etc.
Is there a best practice to duplicate EVERYTHING in one go to another installation?
You could create an SQL dump of your (production) database, spin up a new instance of Omeka S and MySQL - for instance by using Docker - and import the SQL dump into the empty database.
If you also want to duplicate the files to the new instance, you could recursively copy everything in the files directory to the new instance.
I have used this approach several times with our Dockerized stack.
If you don’t want to use Docker, you could create a new instance of Omeka S by recursively copying everything in your installation directory to a new folder and point your reverse proxy (Apache or Nginx) to the new folder.
My dev environment is XAMPP on my Windows computer.
After struggling with importing, here are some lessons I have learned the hard way. Please note, I am not a DBA so this is the reason I don’t know what for others might be trivial.
MySQL uses stupid quotes that are not intuitive. owner_id instead of the usual ‘owner_id’. If you search for something in the exported SQL file using the normal quotes, you will not find it.
Make sure the version of MariaDB you are running on your dev machine is the same as the one in the prod machine. There are differences. Its better to use the correct version than to “fix” the SQL file in order for them to be compatible. You can download all MariaDB version from here https://archive.mariadb.org/
After installing and running the correct MariaDB server, copy all the modules and files to the Omeka installation and then run it so it will create all its tables.
I have the module Extract Text installed and it chokes the import process. I have asked an LLM engine to create a Pytnon code that filters out this data.
python
read file large-omeka-export.sql
write to smaller-omeka-import.sql all lines that don't begin with
INSERT INTO `fulltext_search`
A normal SQL import will fail due to foreign key constraints. You need to disable foreign key checks before the import.
Assuming you have created the database omekas and the user omekauser, here are the commands for the importing process
log in to mysql
mysql -u omekauser -p
start logging everything
tee import-log.txt;
tell mysql what database to use
use omekas;
disable FOREIGN_KEY_CHECKS
SET FOREIGN_KEY_CHECKS = 0;
import from the sql file
SOURCE smaller-omeka-import.sql;
enable FOREIGN_KEY_CHECKS
SET FOREIGN_KEY_CHECKS = 1;
stop the logging and close the file
notee;
profit
Again. This is what worked for me, and I am sharing it here for the benefit of the community. I am not a doctor or a lawyer. YMMV.