Skip to content

Document Migrations - #563

Merged
bricelam merged 1 commit into
dotnet:masterfrom
bricelam:migrate
Nov 15, 2017
Merged

bricelam merged 1 commit into
dotnet:masterfrom
bricelam:migrate

Conversation

@bricelam

Copy link
Copy Markdown
Contributor

Resolves #204

myDbContext.Database.Migrate();
```

> [!WARNING]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should be more explicit about not running migrations at application startup except in very specific cases, such as testing or client apps with a local database. The advice we have generally been giving is that even if you want to use the update-database command on your production database it should only be done in a controlled environment as part of a controlled application deployment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

b.Property<bool>("Deactivated");
===
b.Property<int>("LoyaltyPoints");
>>> Theirs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Wow, that didn't render right...

@ghost ghost removed the cla-already-signed label Nov 14, 2017
Custom Migrations Operations
============================
The MigrationBuilder API allows you to perform many different kinds of operations during a migration, but it's far from
exhaustive. However, the API is also extensible allowing you to define your own operations. There are two to extend the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo: "There are two to extend..."

}
```

Each provider can now decide what SQL to generate for this operation in their `IMigrationsSqlGenerator` service. Here is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe note here something like "this approach only works if every provider knows how to generate SQL for the operation." To align with the similar statement above about .Sql

<<<<<<< Mine
b.Property<bool>("Username");
=======
b.Property<int>("Alias");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't both properties be the same type in this example, since both are just renames?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

lol, thanks. Copy-and-paste error. I'm going to turn some of the code here (in in the tools docs) into samples.

@ajcvickers ajcvickers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great to me!

@bricelam
bricelam merged commit dbf2d06 into dotnet:master Nov 15, 2017
@bricelam
bricelam deleted the migrate branch November 15, 2017 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants