Skip to content

Instantly share code, notes, and snippets.

@sevein
Last active October 9, 2015 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sevein/3538681 to your computer and use it in GitHub Desktop.
Save sevein/3538681 to your computer and use it in GitHub Desktop.
ICA-AtoM 1.3 - Error upgrading from Release 1.1 (step v63)

ICA-AtoM 1.3 - Error upgrading from Release 1.1 (step v63)

Checkout the status of the issue in our issue tracker: https://projects.artefactual.com/issues/4970

During the upgrade from Release 1.1 to Release 1.3 you may find the following problem:

>> upgrade-sql Upgrading from Release 1.1
>> upgrade-sql The task failed while upgrading to upgrade to v63
SQLSTATE[HY000]: General error: 1025 Error on rename of './icaatom130/slug' to './icaatom130/#sql2-d08-5db98' (errno: 152

If so, please follow the next instructions:

  1. Drop the database that you just created for ICA-AtoM 1.3:
    $ mysql -u user -e "DROP DATABASE icaatom_13"
  
  1. Create the database again:
    $ mysql -u user -e "CREATE DATABASE icaatom_13 CHARACTER SET utf8 COLLATE utf8_unicode_ci"
  
  1. Load your old database again:
    $ mysql -u user icaatom_13 < icaatom_old.sql
  
  1. Under the ICA-AtoM 1.3 root directory, open the file lib/task/migrate/arUpgrader110.class.php with a text editor like Vim.
  2. Go to the line 770, you will see the following block of code:
    // Add ON DELETE CASCADE in slug.object_id
    $connection = Propel::getConnection();
    $connection->exec('SET FOREIGN_KEY_CHECKS = 0');
    $sql = "ALTER TABLE `slug`
              DROP FOREIGN KEY `slug_FK_1`,
              ADD FOREIGN KEY (`object_id`)
                REFERENCES  `qubit`.`object` (`id`)
                ON DELETE CASCADE
                ON UPDATE RESTRICT;";
    $connection->exec($sql);
    $connection->exec('SET FOREIGN_KEY_CHECKS = 1');
  
  1. We are going to add two extra lines at the top and the bottom of the block to make the PHP interpreter to ignore it:
    /*
    // Add ON DELETE CASCADE in slug.object_id
    $connection = Propel::getConnection();
    $connection->exec('SET FOREIGN_KEY_CHECKS = 0');
    $sql = "ALTER TABLE `slug`
              DROP FOREIGN KEY `slug_FK_1`,
              ADD FOREIGN KEY (`object_id`)
                REFERENCES  `qubit`.`object` (`id`)
                ON DELETE CASCADE
                ON UPDATE RESTRICT;";
    $connection->exec($sql);
    $connection->exec('SET FOREIGN_KEY_CHECKS = 1');
    */
  
  1. Save the changes, close your editor and try running the upgrade script again:
$ php symfony tools:upgrade-sql
  1. Undo the changes done in the file and save.

Why is this happening?

We don't know yet! I can't even reproduce it locally.

It may be related to the MySQL version being used. In my development environment, I am using MySQL 5.5.x, but we tested it against both 5.5.x and 5.1.x.

Users under the following scenarios reported the problem so far:

#### User A

  • Linux CentOS 6.3
  • MySQL Server 5.0.77
  • PHP 5.3.13
  • PHP MySQL Client API 5.1.61

#### User B

  • Linux RedHat 6.2
  • MySQL Server 5.1.61
  • PHP 5.3.3
  • PHP MySQL Client API 5.1.61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment