Skip to content

Commit

Permalink
Documentation Update: Add from and to usage examples to migration scr…
Browse files Browse the repository at this point in the history
…ipt samples (#2142)

* Add from and to usage examples to migration script samples

Add from and to usage examples to migration script samples on the Migrations page under the General SQL Scripts section.

* removed -From and -To to keep consistency
  • Loading branch information
ccjx committed Mar 6, 2020
1 parent dee9ebd commit 7697034
Showing 1 changed file with 28 additions and 0 deletions.
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 20190725054716_Add_new_tables
```

#### With From and To
This will generate a SQL script from the `from` migration to the specified `to` migration.
```powershell
Script-Migration 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.*

***

There are several options to this command.
Expand Down

0 comments on commit 7697034

Please sign in to comment.