googleapis / googleapis/dotnet-spanner-entity-framework

scaffolding: CHECK CONSTRAINT cannot be scaffolded

Open
#8 0 comments 3 reactions 0 assignees View on GitHub
known limitation type: feature request
Dominant language
C#
Stars
34
Forks
13
Avg merge
4h 39m
Merged PRs (30d)
10

Description

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:
```cs
entity.HasAnnotation("CONSTRAINT `Chk_Languages_Lyrics_Length_Equal`", "CHECK ARRAY_LENGTH(LyricsLanguages) = ARRAY_LENGTH(Lyrics)");
```

Expected:
```cs
entity.HasCheckConstraint("Chk_Languages_Lyrics_Length_Equal", "ARRAY_LENGTH(LyricsLanguages) = ARRAY_LENGTH(Lyrics)");
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.