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

Migrations: Annotate NRTs #24311

Merged
1 commit merged into from
Mar 5, 2021
Merged

Migrations: Annotate NRTs #24311

1 commit merged into from
Mar 5, 2021

Conversation

bricelam
Copy link
Contributor

@bricelam bricelam commented Mar 2, 2021

Fixes #24328, part of #19007

@bricelam bricelam requested a review from a team March 2, 2021 22:36
@@ -1635,10 +1639,10 @@ public MigrationBuilder([CanBeNull] string activeProvider)
public virtual OperationBuilder<UpdateDataOperation> UpdateData(
[NotNull] string table,
[NotNull] string[] keyColumns,
[NotNull] object[] keyValues,
[NotNull] object?[] keyValues,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, do we allow nulls in key values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️ @AndriySvyryd?

@@ -17,25 +19,25 @@ public class AddCheckConstraintOperation : MigrationOperation, ITableMigrationOp
/// <summary>
/// The name of the check constraint.
/// </summary>
public virtual string Name { get; [param: NotNull] set; }
public virtual string Name { get; [param: NotNull] init; } = null!;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at usage, it seems like we could add a constructor that accepts the non-nullable types - instantiation sites already initialize these properties (but with an initializer instead of a constructor). Would be a (very) small breaking change, but may be worth it?

(same for the other operations)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refuse to make breaking changes for the sake of nullability (although I'll certainly avoid several patterns in the future because of it). But I'm not against adding the constructors now and putting [Obsolete] on the default constructor... We should discuss in a design meeting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I will push back against anything that's part of an object graph since constructors force you to build everything inside-out which is much too tedious in tests.

P.S. This init was accidentally left in--I was playing with different patterns trying to get the compiler to warn if you didn't initialize the properties during object initialization. Unfortunately, it would require a custom analyzer.

Copy link
Member

@roji roji Mar 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was just a suggestion, definitely nothing we have to do. Migration operations do seem to me like simple-enough types that this pattern would well for them.

P.S. This init was accidentally left in--I was playing with different patterns trying to get the compiler to warn if you didn't initialize the properties during object initialization. Unfortunately, it would require a custom analyzer.

I think that by design, init-only properties aren't meant to be "these must be set during initialization", only "these may be set during initialization, but not afterwards".

@ghost
Copy link

ghost commented Mar 5, 2021

Hello @bricelam!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost
Copy link

ghost commented Mar 5, 2021

Apologies, while this PR appears ready to be merged, I've been configured to only merge when all checks have explicitly passed. The following integrations have not reported any progress on their checks and are blocking auto-merge:

  1. Azure Pipelines

These integrations are possibly never going to report a check, and unblocking auto-merge likely requires a human being to update my configuration to exempt these integrations from requiring a passing check.

Give feedback on this
From the bot dev team

We've tried to tune the bot such that it posts a comment like this only when auto-merge is blocked for exceptional, non-intuitive reasons. When the bot's auto-merge capability is properly configured, auto-merge should operate as you would intuitively expect and you should not see any spurious comments.

Please reach out to us at fabricbotservices@microsoft.com to provide feedback if you believe you're seeing this comment appear spuriously. Please note that we usually are unable to update your bot configuration on your team's behalf, but we're happy to help you identify your bot admin.

@ghost ghost merged commit 673e6ca into dotnet:main Mar 5, 2021
@bricelam bricelam deleted the nrtm branch March 6, 2021 00:28
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SqlServer Migrations: NullRef when removing database collation
2 participants