Some Foreign Keys are completely ignored casing INSERTs to fail
See original GitHub issueThis 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 showsId
,ClaimType
andClaimValue
. The property/columnRoleId
is completely ignored;IdentityUserClaim
: Same, we haveId
,ClaimType
andClaimValue
, andUserId
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) andUserId
(for Identity User Claim) - Trying to add a new record should render the field
RoleId
/UserId
, accordingly
Actual result
- The columns
RoleId
orUserId
are not shown in the query - The fields
RoleId
orUserId
are not rendered in the CRUD form
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Fixed in version 1.3.2. PR #51