Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB::commit() not saving changes to database #77

Open
N00BEST opened this issue Nov 8, 2020 · 0 comments
Open

DB::commit() not saving changes to database #77

N00BEST opened this issue Nov 8, 2020 · 0 comments

Comments

@N00BEST
Copy link

N00BEST commented Nov 8, 2020

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.

imagen

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:
imagen

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
imagen

videos table
imagen

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
imagen

videos table
imagen

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant