question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Deleting last relation tries to update this record and throws an error

See original GitHub issue

Bug report

What I did

I added a relationship with multiple fields. I can add multiple relationship records. When I delete a relationship record it works exept when I try to delete the last record. Then it tries to update this record with an empty parent Id, and thus throwing an error “Cannot insert the value NULL into column …”

What I expected to happen

Delete the record and not update with emtpy parent ID

Is it a bug in the latest version of Backpack?

Yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 7.4.21 (cli) (built: Jul 1 2021 16:09:23) ( NTS ) Copyright © The PHP Group Zend Engine v3.4.0, Copyright © Zend Technologies with Zend OPcache v7.4.21, Copyright ©, by Zend Technologies

LARAVEL VERSION:

v8.83.1@bddba117f8bce2f3c9875ca1ca375a96350d0f4d

BACKPACK VERSION:

5.0.6@2be4ff8407259f528a3541f0569ce156bab63165

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
howest-wardcommented, Feb 16, 2022

Thanks, learned something today! I downloaded the changes as explained, removed the ‘force_delete’ => true and the problem is gone! Solved!

0reactions
pxpmcommented, Feb 16, 2022

Going to close, let’s keep the conversation in the PR thread if needed!

Thanks again @howest-ward

Read more comments on GitHub >

github_iconTop Results From Across the Web

13766: No rows were affected by the update or delete operation
I try make new DNS in ODBC with connection to MDB file. In this DNS work update records fine. This seems must be...
Read more >
Error when you update a row of a table - SQL Server
This article provides a workaround for the problem that occurs when you try to update a table by using SQL Server Management Studio...
Read more >
Eloquent model terrible bug (Delete all table rows!) #12038
Hi there, Last day I found a terrible bug (I guess) in Laravel Eloquent model which cause loosing all of my data! Imagine...
Read more >
Hibernate - Batch update returned unexpected row count from ...
The solution is to use select for update when fetching the record to lock the row, so nothing else can delete it before...
Read more >
Error 'Your attempt to delete record name could not be ...
This issue is therefore caused if there is a custom Lookup relationship on Leads with Contacts, and is set so that if you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found