In a certain part of the system I need to do transaction control, but this operation involves tables that are in different databases.
I made a test by inserting two tables into different banks and at the end of them doing a rollback
, as it was expected this operation failed, rollback
happened only in the first table.
Is there any way to control transactions given this scenario?
Remarks:
- I'm using Laravel.
- Both banks are mysql
The test I did contained the following code:
DB::beginTransaction();
Aluno::create(['nome' => 'teste']);
Professor::create(['nome' => 'teste2' ]);
DB::rollback();
In each model I set a% w / o% different.