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.

Some Foreign Keys are completely ignored casing INSERTs to fail

See original GitHub issue

This is a follow up to #49, although I’m not sure if the issues are technically related, other than having been discovered in the same scenario (trying to manage the ASP.NET Core Identity data model with EasyData).

EasyData seems to ignore some FK columns in some entities. The corresponding column/value is not shown in the data grid, the field is not rendered at all in the CRUD form, and any INSERT will fail because the FK ends up being NULL.

Two examples:

  • IdentityRoleClaim: EasyData shows Id, ClaimType and ClaimValue. The property/column RoleId is completely ignored;
  • IdentityUserClaim: Same, we have Id, ClaimType and ClaimValue, and UserId is ignored;

Trying to create a new record on either table will fail with (example for IdentityUserClaim):

Ooops, smth went wrong

Cannot insert the value NULL into column ‘UserId’, table ‘EasyDataDB.dbo.AspNetUserClaims’; column does not allow nulls. INSERT fails. The statement has been terminated.

Steps to reproduce

  • Create a new project with “Individual accounts” (dotnet new webapp --auth Individual)
  • Setup EasyData
  • Browse for example /easydata/IdentityRoleClaim or /easydata/IdentityUserClaim

Expected result

  • An empty grid (as there are no records yet), including the column RoleId (for Identity Role Claim) and UserId (for Identity User Claim)
  • Trying to add a new record should render the field RoleId / UserId, accordingly

Actual result

  • The columns RoleId or UserId are not shown in the query
  • The fields RoleId or UserId are not rendered in the CRUD form

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
chaghicommented, Aug 9, 2021

Hi, thanks for taking the time to explain that, I appreciate it! I can confirm that having rebuilt the frontend as per your instructions, the issue appears to be fixed.

0reactions
antifreecommented, Aug 11, 2021

Fixed in version 1.3.2. PR #51

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can MySql quietly abandon inserts where foreign key fails?
Yes, with the ignore keyword: INSERT IGNORE INTO `foo` (...) VALUES (...); If you use the IGNORE keyword, errors that occur while executing ......
Read more >
SQL Foreign key
In this article let us review different ways to create a SQL foreign key, rules on updates and deletes, enabling foreign key constraints, ......
Read more >
Foreign Key constraint error when inserting a record
Any value you pass as id when creating a new record will be ignored if they are not found in the entity (In...
Read more >
Do Foreign Keys Matter for Insert Speed
Do foreign keys hurt the performance of inserts? Okay, we all know that foreign keys do require some work, but the crazy people...
Read more >
Restoring from pg_dump with foreign key constraints
In restoring a database from a pg_dump , a number of errors are being generated and the whole table is subsequently being ignored....
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