Closed digason closed 2 years ago
I had the same issue. It looks like it's not possible to run `$this->dropColumn($table, 'siteId') because there's an index associated with it. Sadly, because the index name is generated automatically, there's no quick way to find that one to drop it. I faced similar issue in some other plugin and ran something like this:
foreach (Craft::$app->db->getSchema()->findIndexes($table) as $name => $index) {
$this->dropIndex($name, $table);
}
I'm not great with migrations, but hope that @internetztube can figure out how to incorporate this into the latest or next rev.
Migration fails when upgrading from 1.0.6 to 1.2.3. Running Craft Pro 3.7.30.1
`Database Exception: SQLSTATE[HY000]: General error: 1828 Cannot drop column 'siteId': needed in a foreign key constraint 'fk_hsuqnkfyhtjzftcimobzwkwtwqutqrjuloos' The SQL being executed was: ALTER TABLE elementrelations DROP COLUMN siteId
Migration: internetztube\elementRelations\migrations\m220104_164702_simplify_cache_strategy
Output: