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

Improvements to migration docs #2430

Merged
merged 5 commits into from
Jun 29, 2020
Merged

Improvements to migration docs #2430

merged 5 commits into from
Jun 29, 2020

Conversation

roji
Copy link
Member

@roji roji commented Jun 4, 2020

  • 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
Copy link
Member Author

roji commented Jun 5, 2020

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


### Namespaces
* We generally recommend using the [.NET Core CLI tools](xref:core/miscellaneous/cli/dotnet), which work on all platforms.
Copy link
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
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
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
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

### Namespaces
* We generally recommend using the [.NET Core CLI tools](xref:core/miscellaneous/cli/dotnet), which work on all platforms.
Copy link
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.

entity-framework/core/managing-schemas/migrations/index.md Outdated Show resolved Hide resolved
entity-framework/core/managing-schemas/migrations/index.md Outdated Show resolved Hide resolved
@bricelam
Copy link
Contributor

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

@bricelam
Copy link
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?

Copy link
Member

@JeremyLikness JeremyLikness left a comment

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

entity-framework/core/managing-schemas/migrations/index.md Outdated Show resolved Hide resolved
entity-framework/core/managing-schemas/migrations/index.md Outdated Show resolved Hide resolved
entity-framework/core/managing-schemas/migrations/index.md Outdated Show resolved Hide resolved

### Namespaces
* We generally recommend using the [.NET Core CLI tools](xref:core/miscellaneous/cli/dotnet), which work on all platforms.
Copy link
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
Copy link
Member Author

roji commented Jun 27, 2020

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?

Copy link
Contributor

@bricelam bricelam left a comment

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.

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