I'm making modifications to two tables in a given time and trying to avoid concurrency problems, so I'm using DB::beginTransaction();
Everything executes just fine, but when I do DB::commit() nothing changes in database. If I execute the exact same code without the transaction, everything goes just fine.
This is my code, I need to add the like to the liked_videos table and increase or decrease the likes/dislikes values on the videos table. If I run this exact code without the DB::commit() it works.
Working code:
I also tried to use DB::transaction($callback) to achieve this, but didn't work either. My database is like this:
Initial State:
liked_videos table
videos table
After not working code (with transaction and commit) it remains the same.
If executed without the beginTransaction and commit it updates the tables to this:
After working code State:
liked_videos table
videos table
I've also tried to run the transaction directly on the database to check if the problem was on my MySql server, but it worked just fine.
I need some advice on see what could be wrong with this or which file I should check in order to submit a pull request with a possible solution.
I'm making modifications to two tables in a given time and trying to avoid concurrency problems, so I'm using
DB::beginTransaction();
Everything executes just fine, but when I do
DB::commit()
nothing changes in database. If I execute the exact same code without the transaction, everything goes just fine.This is my code, I need to add the like to the liked_videos table and increase or decrease the likes/dislikes values on the videos table. If I run this exact code without the
DB::commit()
it works.Working code:
I also tried to use
DB::transaction($callback)
to achieve this, but didn't work either. My database is like this:Initial State: liked_videos table
videos table
After not working code (with transaction and commit) it remains the same.
If executed without the beginTransaction and commit it updates the tables to this:
After working code State: liked_videos table
videos table
I've also tried to run the transaction directly on the database to check if the problem was on my MySql server, but it worked just fine.
I need some advice on see what could be wrong with this or which file I should check in order to submit a pull request with a possible solution.
Thanks in advance. Greetings
N00best.