diff --git a/src/migrations/m240709_120000_add_fieldinstanceuid_column.php b/src/migrations/m240709_120000_add_fieldinstanceuid_column.php index 6e35776d..53d2ac22 100644 --- a/src/migrations/m240709_120000_add_fieldinstanceuid_column.php +++ b/src/migrations/m240709_120000_add_fieldinstanceuid_column.php @@ -15,12 +15,14 @@ public function safeUp(): bool { if ($this->db->columnExists(ElementFieldCacheRecord::tableName(), 'fieldId')) { ElementFieldCacheRecord::deleteAll(); + $this->dropForeignKeyIfExists(ElementFieldCacheRecord::tableName(), ['fieldId']); $this->dropColumn(ElementFieldCacheRecord::tableName(), 'fieldId'); $this->addColumn(ElementFieldCacheRecord::tableName(), 'fieldInstanceUid', $this->uid()->after('elementId')); } if ($this->db->columnExists(ElementQueryFieldRecord::tableName(), 'fieldId')) { ElementQueryFieldRecord::deleteAll(); + $this->dropForeignKeyIfExists(ElementQueryFieldRecord::tableName(), ['fieldId']); $this->dropColumn(ElementQueryFieldRecord::tableName(), 'fieldId'); $this->addColumn(ElementQueryFieldRecord::tableName(), 'fieldInstanceUid', $this->uid()->after('queryId')); }