Upgrading from ICA-AtoM 1.0.x

From AtoM wiki


Main Page > Community > Community resources > Documentation > Upgrading from ICA-AtoM 1.0.x

This page outlines how to upgrade an ICA-AtoM 1.0.x instance to AtoM 2.2.x. Note that these are general guidelines, intended for those familiar with the AtoM upgrade and install process. If you need more help, consider posting on our AtoM user forum.

Note

If you are upgrading from ICA-AtoM 1.1.x, rather than ICA-AtoM 1.0.x, please see the Upgrading page in the AtoM user documentation.

Upgrade 1.0.x database

Create ICA-AtoM 1.0.x instance (in my case it was a 1.0.7 database dump)

wget http://pear.qubit-toolkit.org/get/icaatom-1.0.7.tgz
tar -zxpvf icaatom-1.0.7.tgz
cd icaatom-1.0.7
cp config/databases.yml.tmpl config/databases.yml

Create database with SQL dump and generate YAML dump

mysql -h localhost -u root -p -e "DROP DATABASE qubit;"
mysql -h localhost -u root -p -e "CREATE DATABASE qubit CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
mysql -h localhost -u root -p qubit < ~/sql/icaatom_1.0.7.sql
php symfony propel:data-dump dump.yml

The YAML dump is created in data/fixtures.

Create ICA-AtoM 1.1 instance to upgrade data

cd ..
wget http://pear.qubit-toolkit.org/get/icaatom-1.1.tgz
tar -zxpvf icaatom-1.1.tgz
cd icaatom-1.1
php symfony propel:migrate ../icaatom-1.0.7/data/fixtures/dump.yml

After a lot of PHP notices the dump is updated in migrated_data_20160304060430.yml.

To avoid the web installer but configure the database

There was a lot of errors running the web installer in newer versions of PHP and MySQL.

cp ../icaatom-1.0.7/lib/vendor/symfony/lib/database/sfDatabaseManager.class.php vendor/symfony/lib/database/sfDatabaseManager.class.php
cp ../icaatom-1.0.7/config/databases.yml.tmpl config/databases.yml

Fix PHP and MySQL issues

For PHP versions > 5.3: remove '&' in vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/phing/system/io/UnixFileSystem.php line 194

For MySQL versions > 5.0: replace all 'Type=InnoDB' for 'Engine=InnoDB' in data/sql/lib.model.schema and data/sql/plugins.qbAclPlugin.lib.model.schema.sql

Recreate database, insert SQL and load migrated data

php symfony cc && php symfony cc
mysql -h localhost -u root -p -e "DROP DATABASE qubit;"
mysql -h localhost -u root -p -e "CREATE DATABASE qubit CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
php symfony propel:insert-sql
php symfony propel:data-load migrated_data_20160304060430.yml

Then I got the following error:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'QddI' for key 'slug_U_2'

I enabled the MySQL general log, as I could not find 'QddI' in the data file, and tried again repeating the last four commands, now without problem, I guess it was bad luck creating two exact random slugs ...

Create an SQL dump from the ICA-AtoM 1.1 database

mysqldump -h localhost -u root -p qubit > ~/sql/icaatom_1.1.sql

Create AtoM 2.2.x instance

mysql -h localhost -u root -p -e "DROP DATABASE atom;"
mysql -h localhost -u root -p -e "CREATE DATABASE atom CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
git clone -b stable/2.2.x git@git.artefactual.com:atom.git ../atom-2.2.x

Change folder owner and permissions if needed and run the web installer.

Recreate database with 1.1 dump and upgrade to 2.2.x

mysql -h localhost -u root -p -e "DROP DATABASE atom;"
mysql -h localhost -u root -p -e "CREATE DATABASE atom CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
mysql -h localhost -u root -p atom < ~/sql/icaatom_1.1.sql
cd ../atom-2.2.x
php symfony tools:upgrade-sql