Skip to content

Fix seed data inseration with ValueGeneratedOnAddOrUpdate #21865

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 2 commits into from

Conversation

thehe
Copy link

@thehe thehe commented Jul 30, 2020

If just given equality to ValueGenerated.OnAdd, the case "ValueGenerated.OnAdd | ValueGenerated.OnUpdated" is not handled properly.

This is set by builder method (Fluent API) myProperty.ValueGeneratedOnAddOrUpdate() instead of .ValueGeneratedOnAdd()

thehe added 2 commits July 30, 2020 23:10
If just given equality to `ValueGenerated.OnAdd`, the case "ValueGenerated.OnAdd | ValueGenerated.OnUpdated" is not handled properly.

This is set by builder method (Fluent API) myProperty.ValueGeneratedOnAddOrUpdate() instead of .ValueGeneratedOnAdd()
If just given equality to `ValueGenerated.OnAdd`, the case "ValueGenerated.OnAdd | ValueGenerated.OnUpdated" is not handled properly.

This is set by builder method (Fluent API) myProperty.ValueGeneratedOnAddOrUpdate() instead of .ValueGeneratedOnAdd()
@AndriySvyryd
Copy link
Member

If a property is generated on add and update then it shouldn't be specified in seed data, an exception is appropriate in that case

@thehe
Copy link
Author

thehe commented Aug 2, 2020

Can't agree on that?

Typical example:
User: created_at (ValueGenerateOnAdd), updated_at (ValueGenerateOnAddOrUpdate) => Migration fails, because "updated_at" is non-nullable?!

We can argue, if "updated_at" should be nullable or not, but it's a straight decision to say:
"even in a creation, an entry is updated"?

@AndriySvyryd
Copy link
Member

@thehe Please open an issue with a small repro project that shows the problem

@thehe
Copy link
Author

thehe commented Aug 3, 2020

see #21904

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants