I’m using migrate module 7.x-2.5 with a MySQL source database. My records are defined by the intersection of two tables, so I need two keys in my $source_key parameter to MigrateSQLMap(). I’ve done this before, no problem. But in this case, the columns have the same name, both “id”. Because the column name is used as the key in the $source_key array, the second “id” would replace the first “id”.
I tried defining an alias for one of the columns with addExpression() and using the alias (type_id) as one of the keys. This correctly registers multiple source keys and shows the correct record count on drush ms, but fails on drush mi with a SQL error: “Column not found: 1054 Unknown column ‘type_id’ in ‘on clause'”.
In the short term, I can just create a new column in one of the tables and duplicate the “id” values, but I’d like to know if there’s a way to do this entirely in migrate code without altering the source database.