Difference between revisions of "Community/Community resources/Documentation/Upgrading from ICA-AtoM 1.0.x"

From AtoM wiki
Line 1: Line 1:
 
{{#pagetitle:Upgrading from ICA-AtoM 1.0.x}}
 
{{#pagetitle:Upgrading from ICA-AtoM 1.0.x}}
  
[[Main Page]] > [[Community]] > [[Community/Community resources]] > [[Documentation]]
+
[[Main Page]] > [[Community]] > [[Community/Community resources|Community resources]] > [[Community/Community resources/Documentation|Documentation]] > Upgrading from ICA-AtoM 1.0.x
 +
 
 +
== Upgrade 1.0.x database ==
  
 
Create ICA-AtoM 1.0.x instance (in my case it was a 1.0.7 database dump)
 
Create ICA-AtoM 1.0.x instance (in my case it was a 1.0.7 database dump)
 +
 +
<pre>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</pre>
 +
 +
== Create database with SQL dump and generate YAML dump ==
 +
 +
<pre>
 +
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</pre>
 +
 +
The YAML dump is created in data/fixtures.
 +
 +
== Create ICA-AtoM 1.1 instance to upgrade data ==
 +
 +
<pre>
 +
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</pre>
 +
 +
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.
 +
 +
<pre>
 +
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</pre>
 +
 +
== 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 ==
 +
 +
<pre>
 +
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</pre>
 +
 +
Then I got the following error:
 +
 +
<pre>
 +
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'QddI' for key 'slug_U_2'</pre>
 +
 +
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 ==
 +
 +
<pre>
 +
mysqldump -h localhost -u root -p qubit > ~/sql/icaatom_1.1.sql</pre>
 +
 +
== Create AtoM 2.2.x instance ==
 +
 +
<pre>
 +
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</pre>
 +
 +
Change folder owner and permissions if needed and '''run the web installer'''.
 +
 +
== Recreate database with 1.1 dump and upgrade to 2.2.x ==
 +
 +
<pre>
 +
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</pre>

Revision as of 14:56, 4 March 2016


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

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