Foreign Key between different databases


Is it possible to link between two different databases in one Migration? I'm using Postgres.

What I have:


I need something like:

asked by anonymous 27.06.2016 / 20:10

1 answer


I never needed to do this, but giving a google search I found this solution (I did not test to see if it works):

$table>foreign('id_cliente_produto')>references('id_cliente_produto')->on(new Illuminate\Database\Query\Expression('Banco2.tabela'));

Recommendation: Put the reference to the bank name in some configuration file, in case the name of the bank changes, you only have to change one file.

23.01.2017 / 00:05