Have Database Update ignore prefix for multisite with shared database I currently have a multisite with a single database. Each instance has a different prefix for their tables, except for one with no prefix which is considered to be the main instance. Now there is a custom table I made that contains custom data. That table is meant to be shared across all instances. In a function I'm updating a field like so

$database = \Drupal::database();
$database-&gt;update('custom_table')-&gt;condition('id', $my_id, '=')-&gt;fields(['full_name' =&gt; $fullname, 'address' =&gt; $address])-&gt;execute();


This works on my main site. Unfortunately in the other multisite instances that's using the same function, this is causing an error. In the error I have


  Base table or view not found: 1146 Table
  'database.myprefix_custom_table' doesn't exist


I realize that it's trying to prepend the prefix for the table. But it's a table that every site is meant to share. I don't want a prefix to be used. 

I noticed that the update method can use options as a parameter https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%21Connection.php/function/Connection%3A%3Aupdate/8.2.x 

But I'm not sure if I can tell it not to use a prefix in the options I can supply. 

I understand that I can just use the query method instead of using the update method (I think) but I would like to know:
Is it possible to force the update method for the connection object to not use the database prefix?

UPDATE: This was suggested as a duplicate:
How to identify multi-site programmatically?
But that isn't related to my problem.

In that example it's identifying what site it's on, but it's not performing anything with a database. I know how I can check what site it's on. That's not a problem. I need to call an actual database method and get rid of the prefix it's automatically applying. 

In my code

$database-&gt;update('custom_table')-&gt;condition('id', $my_id, '=')-&gt;fields(['full_name' =&gt; $fullname, 'address' =&gt; $address])-&gt;execute();


I'm not even supplying the prefix. It's automatically applying it without my knowledge if it's being run on another site.
Looking at the comments in settings.php, you may well be able to do something like this:

$databases['default']['default'] = [
  'database' =&gt; 'db_name',
  'username' =&gt; 'root',
  'password' =&gt; 'root',
  'host' =&gt; 'localhost',
  'port' =&gt; '3306',
  'driver' =&gt; 'mysql',
  'prefix' =&gt; [
    'default' =&gt; 'shared_',
    'custom_table' =&gt; '',
  ],
];


I haven't tried it, but in theory that should set the prefix for all tables to shared_, except for the custom one, which would have no prefix.