Skip to content

Improvements to migration docs - #2430

Merged
roji merged 5 commits into
masterfrom
migrations
Jun 29, 2020
Merged

roji merged 5 commits into
masterfrom
migrations

Conversation

@roji

@roji roji commented Jun 4, 2020 •

Copy link
Copy Markdown
Member
  • The overview page now contains a simple tutorial going through the basic steps in a friend way, without over-burdening the user with extra details they don't need to know about (e.g. namespace, migration file naming).
  • The more exhaustive detailing of each command has been moved out to two new pages:
    • Managing migrations: everything about adding, removing and editing migrations.
    • Deploying migrations: generating SQL scripts, dotnet ef database update, Migrate() (and its pitfalls), etc. This is where we compare the different deployment strategies etc.
  • I wasn't sure if we should show idempotent migrations in the tutorial, since they currently have quite a few limitations. I also added a note that they have some limitations, but we should probably list what those limitations are.
  • In many places the full name of the migration was specified on the command line samples - including the timestamp. I removed that for simplicity - hope that's OK.
  • Is there not List-Migrations in the PMC tool? If there is, it ain't documented.
  • Note that ASP.NET also have a migrations tutorial. I can't really see anything web-related in there, maybe we should see about having them point to our docs?

Closes #814
Closes #694
Closes #2369
Closes #2188
Closes #1048
Part of #691

@roji
roji force-pushed the migrations branch 3 times, most recently from eed3de0 to 334f0a2 Compare June 5, 2020 00:15
@roji

roji commented Jun 5, 2020

Copy link
Copy Markdown
Member Author

@bricelam @ajcvickers @JeremyLikness this isn't quite ready/proofed yet, but if you feel like taking a look go ahead :) I'll do another pass tomorrow and mark this ready for review.

First, you'll have to install the [EF Core command-line tools](xref:core/miscellaneous/cli/index):

### Namespaces
* We generally recommend using the [.NET Core CLI tools](xref:core/miscellaneous/cli/dotnet), which work on all platforms.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is it fair to say we recommend the CLI over PMC as a general rule, unless otherwise? That seems to make sense, from a cross-platform cross-IDE standpoint.

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.

Yes, I think we should start recommending them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, "which works"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should it be plural because we speak of CLI tools?

@roji
roji marked this pull request as ready for review June 8, 2020 18:41
First, you'll have to install the [EF Core command-line tools](xref:core/miscellaneous/cli/index):

### Namespaces
* We generally recommend using the [.NET Core CLI tools](xref:core/miscellaneous/cli/dotnet), which work on all platforms.

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.

Yes, I think we should start recommending them.

@bricelam

Copy link
Copy Markdown
Contributor

I don't think most applications will hit the idempotent script issues, but if you want to list them:

@bricelam

Copy link
Copy Markdown
Contributor

I removed the timestamp from the migration names

Sounds good. I think I had them there because that's how PMC tab-completes

Is there not List-Migrations in the PMC tool?

No. But I think there's a community PR out that adds them.

Note that ASP.NET also have a migrations tutorial. I can't really see anything web-related in there, maybe we should see about having them point to our docs?

I'd be fine with hosting them in our docs. How much do they build off the previous ASP.NET tutorials?

@JeremyLikness JeremyLikness left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

...with changes for consideration

dotnet ef migrations add AddNewTables --idempotent
```

#### [Visual Studio](#tab/vs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should something go here about accessing the Package Management Console, for the context of where these commands are run from?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You mean general information on the PMC and how to install the tools, right? If so, we have the dedicated page on that, and there's the "install the tools" paragraph (with a link to the dedicated page) in the migration's index.html. Do you think we need something more?


For more information on applying migrations via the command-line tools, see the [EF Core tools reference](xref:core/miscellaneous/cli/index).

## Apply migrations at runtime

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there guidance on how to create a standalone executable for this that would be an interim solution until the new bundling features are ready? It seems some companies will build a console app just to host the migrations code and deploy that to run as part of CI/CD separate from the web app consuming the database.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not specifically aware of people going to those lengths (but maybe @bricelam is)... Typically people either deploy via SQL scripts (which is what we usually recommend), or they just stick Migrate in their program startup, which is what we try to discourage...

I guess that since @bricelam is specifically working on bundles, we may want to hold off for now and just document that once it lands...

First, you'll have to install the [EF Core command-line tools](xref:core/miscellaneous/cli/index):

### Namespaces
* We generally recommend using the [.NET Core CLI tools](xref:core/miscellaneous/cli/dotnet), which work on all platforms.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, "which works"

@roji

roji commented Jun 27, 2020

Copy link
Copy Markdown
Member Author

Have made the changes here, @bricelam in particular I've redone the tutorial to show dotnet ef migrations instead of SQL scripts - do you want to give this a quick final look?

@bricelam bricelam 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.

I just love this organization--much easier to grok.

@roji
roji merged commit 2c06834 into master Jun 29, 2020
@smitpatel
smitpatel deleted the migrations branch July 8, 2020 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants