Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

scaffolding: CHECK CONSTRAINT cannot be scaffolded

Open
#8 0 comments 3 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
database

Research direction

No source file or test is named. Start by tracing how database CHECK constraints are represented in scaffolding metadata and how that metadata becomes generated entity configuration; compare the reported output with the expected HasCheckConstraint form. Done means scaffolded output preserves the constraint name and expression so recreating the database includes the CHECK constraint.

Written by the indexing model from the issue text.

Description

known limitation type: feature request

EF Core supports defining check constraints when working code-first, but there is nothing in the scaffolding metadata that allows us to define this when generating code from the database. This means that when a database with existing CHECK constraints is scaffolded and the output is used to generate a new database, the CHECK constraints will not be included in the new database.

Script:
CONSTRAINT Chk_Languages_Lyrics_Length_Equal CHECK (ARRAY_LENGTH(LyricsLanguages) = ARRAY_LENGTH(Lyrics))

Actual:

entity.HasAnnotation("CONSTRAINT `Chk_Languages_Lyrics_Length_Equal`", "CHECK ARRAY_LENGTH(LyricsLanguages) = ARRAY_LENGTH(Lyrics)");

Expected:

entity.HasCheckConstraint("Chk_Languages_Lyrics_Length_Equal", "ARRAY_LENGTH(LyricsLanguages) = ARRAY_LENGTH(Lyrics)");
Dominant language
C#
Stars
34
Forks
13
Avg merge
1d 10h
Merged PRs (30d)
19

Getting set up

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 googleapis/dotnet-spanner-entity-framework

All issues in googleapis/dotnet-spanner-entity-framework

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.