RevEng: Use alternate key when no primary key

Open
#19,918 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp, sqlite
Domain
databases, tooling

Research direction

The issue names no files, tests, or entry points; start by tracing EF Core's reverse-engineering path for primary keys and SQLite schema metadata, then read the context in #5719, #8840, and #18633. Done would cover unique constraints or indexes when no primary key exists and map SQLite's implicit rowid where applicable.

Written by the indexing model from the issue text.

Description

area-scaffolding ef6-parity

Mentioned in #5719 but got missed:

If there is no primary key defined, we could fallback to using a unique constraint/index if there is one.

And from #8840:

If a table in SQLite doesn't have an explicit primary key, the implicit rowid column can be used to uniquely identify a row. We should map the rowid column to a property in this case.

This would help unorthodox schemas like the ones in #18633 work better

Dominant language
C#
Stars
14.8k
Forks
3.4k
Avg merge
2d 5h
Merged PRs (30d)
134

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/efcore

All issues in dotnet/efcore

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.