protected function nullifyInvalidForeignKey($table, $field, $linkedTable, $linkedField)
    {
        $platform = $this->connection->getDatabasePlatform();
        $sqlTable = $platform->quoteSingleIdentifier($table);
        $sqlField = $platform->quoteSingleIdentifier($field);
        $sqlLinkedTable = $platform->quoteSingleIdentifier($linkedTable);
        $sqlLinkedField = $platform->quoteSingleIdentifier($linkedField);
        $this->connection->executeQuery("
            update {$sqlTable}
            left join {$sqlLinkedTable} on {$sqlTable}.{$sqlField} = {$sqlLinkedTable}.{$sqlLinkedField}
            set {$sqlTable}.{$sqlField} = null
            where {$sqlLinkedTable}.{$sqlLinkedField} is null
        ");
    }