am-impact / amnav

Navigation plugin for Craft
168 stars 20 forks source link

Can't upgrade from 1.4.3 #28

Closed bgarrant closed 9 years ago

bgarrant commented 9 years ago

I am trying to upgreade to latest version 1.5.3 and I just keep getting an error and rollback message. I am on version 1.4.3.

bgarrant commented 9 years ago

I can't seem to upgrade from 1.4.3 to 1.5.0 either. I have not even created any nav menus yet. Any idea why the error?

bgarrant commented 9 years ago

I uninstalled 1.4.3 and ionstalled 1.5.3 for now, but the upgrade process did not work on three Craft sites running 1.4.3

hubertprein commented 9 years ago

@bgarrant Thanks for bringing this to my attention :)

Something with one of the migration files. Located the problem and working on a fix.

engram-design commented 9 years ago

@hubertprein FYI, I've made the following changes to the migration files, and seems to upgrade properly.

Changing the table name from amnav_pages to amnav_nodes in m150217_112800_AmNav_expandPageData.php fixes the first issue - as the previous migration renamed this table already, so amnav_pages doesn't exist.

// Add columns
$this->addColumnAfter('amnav_nodes', 'locale', array(ColumnType::Locale, 'default' => null), 'entryId');

// Add index
$this->createIndex('amnav_nodes', 'entryId,locale');

// Update existing records with the primary locale
craft()->db->createCommand()->update('amnav_nodes', array('locale' => craft()->i18n->getPrimarySiteLocaleId()));

And in m150403_093000_AmNav_nodesWithElements.php, it's having issues dropping an index from the old table - because of the above fix, the table has already been renamed, and the entryId,locale index has been created on the amnav_nodes table. As such, there's no need to rename back to the old table name, but you still need to drop the index, because the column is being renamed later in that migration.

//$this->renameTable('amnav_nodes', 'amnav_pages');
$this->dropIndex('amnav_pages', 'entryId,locale');
//$this->renameTable('amnav_pages', 'amnav_nodes');

Hope that helps!

hubertprein commented 9 years ago

@engram-design Thanks for your answer.

I made a mistake with a migration date, which ruins later migrations. I edited the migrations files with your fix. Thanks Josh!

engram-design commented 9 years ago

@hubertprein Ah I see! No worries - love the latest additions of categories by the way :)

hubertprein commented 9 years ago

@engram-design I'm glad you like it :)