Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-nullable bool domain is scaffolded to nullable property #1626

Closed
kobruleht opened this issue Dec 28, 2020 · 2 comments · Fixed by #1634
Closed

Non-nullable bool domain is scaffolded to nullable property #1626

kobruleht opened this issue Dec 28, 2020 · 2 comments · Fixed by #1634
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kobruleht
Copy link

kobruleht commented Dec 28, 2020

Steps to reproduce:

  1. Create non-nullable bool in postgres:

CREATE DOMAIN ebool AS bool DEFAULT false NOT NULL;

  1. Create column with this type

CREATE TABLE test ( testbool ebool );

  1. Generate classes from database using

dotnet ef dbcontext scaffold "Host=my_host;Database=my_db;Username=my_user;Password=my_pw" Npgsql.EntityFrameworkCore.PostgreSQL

Observed:

Property is bool? type:

public partial class Test
{
    public bool? Testbool { get; set; }

Expected:
Property should be bool type:

    public bool Testbool { get; set; }
@kobruleht kobruleht changed the title non-nullable boolean is mapped to nullable bool Non-nullable bool domain is mapped to nullable property Dec 28, 2020
@roji roji changed the title Non-nullable bool domain is mapped to nullable property Non-nullable bool domain is scaffolded to nullable property Jan 5, 2021
roji added a commit to roji/efcore.pg that referenced this issue Jan 5, 2021
@roji roji self-assigned this Jan 5, 2021
@roji roji added this to the 5.0.2 milestone Jan 5, 2021
@roji roji added the bug Something isn't working label Jan 5, 2021
@roji roji closed this as completed in #1634 Jan 7, 2021
roji added a commit that referenced this issue Jan 7, 2021
@kobruleht
Copy link
Author

It looks like this commit does not add support for not-nullable boolean. It adds only not-nullable string and integer type support.

@roji
Copy link
Member

roji commented Jan 9, 2021

@kobruleht what makes you say that? The tests check int/string, but the change itself is valid for any PostgreSQL domain, isn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants