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

Documentation Update: Add from and to usage examples to migration script samples #2142

Merged
merged 2 commits into from
Mar 6, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions entity-framework/core/managing-schemas/migrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,44 @@ When debugging your migrations or deploying them to a production database, it's

### [.NET Core CLI](#tab/dotnet-core-cli)

#### Basic Usage
```dotnetcli
dotnet ef migrations script
```

#### With From (to implied)
This will generate a SQL script from this migration to the latest migration.
```dotnetcli
dotnet ef migrations script 20190725054716_Add_new_tables
```

#### With From and To
This will generate a SQL script from the `from` migration to the specified `to` migration.
```dotnetcli
dotnet ef migrations script 20190725054716_Add_new_tables 20190829031257_Add_audit_table
```
You can use a `from` that is newer than the `to` in order to generate a rollback script. *Please take note of potential data loss scenarios.*

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

#### Basic Usage
``` powershell
Script-Migration
```

#### With From (to implied)
This will generate a SQL script from this migration to the latest migration.
```powershell
Script-Migration -From 20190725054716_Add_new_tables
bricelam marked this conversation as resolved.
Show resolved Hide resolved
```

#### With From and To
This will generate a SQL script from the `from` migration to the specified `to` migration.
```powershell
Script-Migration -From 20190725054716_Add_new_tables -To 20190829031257_Add_audit_table
```
You can use a `from` that is newer than the `to` in order to generate a rollback script. *Please take note of potential data loss scenarios.*

***

There are several options to this command.
Expand Down