Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When attempting to migrate forum_access
rules into a D7 site, the Migrate module generates the following error:
Auditing migrations
Invalid argument supplied for foreach() table.inc:39
The line in question is this one:
https://cgit.drupalcode.org/migrate/tree/plugins/destinations/table.inc#n39
The problem is the forum_access
table doesn't have a primary key defined. Beyond the migration issue, I think it's good practice to define a primary key.
The attached patch fixes the issue by adding "primary key" to the schema and including an update to run db_add_primary_key
.
Please review, thanks.
Comment | File | Size | Author |
---|---|---|---|
#7 | forum_access-add_primary_key-3002918-3-D8.patch | 4.41 KB | salvis |
#3 | forum_access-add_primary_key-3002918-3.patch | 1.31 KB | ron_s |
Comments
Comment #2
salvisThank you for your report and patch, ron_s!
Are you migrating D6 to D7? This should be a simple upgrade as far as Forum Access is concerned. Or am I missing something?
There's no downside to adding a tid+rid primary key, I guess, but then we should remove the tid index.
Comment #3
ron_s CreditAttribution: ron_s commentedGood point on removing the tid index. See updated patch.
Yes, this is a D6 to D7 upgrade. I agree, I would have thought it would be simple.
I have a straightforward mapping using
MigrateDestinationTable
, and aMigrateSQLMap
using tid and rid as the keys:Have created migrations for many other tables, and
forum_access
is the first time I've run into any problem like this.I also ran into a second migration issue regarding Forum Access that I'm going to post separately.
Comment #4
ron_s CreditAttribution: ron_s commentedCross-referencing the other forum_access issue I had when migrating: https://www.drupal.org/project/forum_access/issues/3003279
Comment #5
salvisYes, this looks good now, and we need the same thing for D8.
Why do you need to use Migrate at all? I just upgraded a D6 site to D7 directly, without Migrate, and it seems to work fine.
Comment #6
ron_s CreditAttribution: ron_s commentedGood question, with a very straightforward reason.
These are not upgrades. We're using Drupal 6 sites as data repositories to import into a vastly different D7 solution. They will all be part of a single, consistent codebase.
Some of the sites were built by us, and some were built by others. Very little in the D6 sites match what we have in the new platform, so we are mapping what they do have into the proper fields, content types, etc.
Comment #7
salvisD8 version of the patch.
Comment #10
salvisPushed to D8.
Comment #12
salvisThank you, ron_s!