question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Remove-Migration` command not removing migrations from TFS Pending Changes

See original GitHub issue

Current Behvaior

After applying a Migration using the Add-Migration <MigrationName> command. A new migration is added; however, if I decide to revert those changes and use Remove-Migration, the latest migration is removed from the project, but is still registered as a pending [add] change in TFS.

I was expecting that if the migration was removed through the PM Console that the changes would also be undone. These files have to manually have their changes undone from the Pending Changes panel.

Steps to reproduce

  1. Add a migration with Add-Migration "MyFancyMigration"
  2. See that the MyFancyMigration.cs and MyFancyMigration.Designer.cs are listed as adds in Pending Changes.
  3. Try to remove the migration with the Remove-Migration command
  4. Note that the migration has not been removed from the Pending Changes
  5. Try to check in and you should receive a message similar to this:
Could not find file 'C:\<local_path>\Migrations\20180323193556_MyFancyMigration.cs'.

Further technical details

EF Core version: 2.1.3-preview1-final (occurred also on 2.0.2) Database Provider: Microsoft.EntityFrameworkCore.SqlServer Operating system: Windows 10 IDE: VS 2017 15.6.4 Source Control: TFS/VSTS

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:26 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
Psypher9commented, Jan 11, 2019

UPDATE: This is fully functioning as of VS 2019 Preview 1. So I think I’ll close this now, because it can’t be an EF Core problem.

1reaction
Psypher9commented, Aug 30, 2018

Cool, I will see what I can do then. So is the original intent to have the Remove-Migration command take a step back on the Snapshot and remove the latest migration from the project while not removing it from the disk?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Entity-Framework Core Remove-Migration (after add ...
Then, I run an "Remove-Migration" command in the Package Manager Console. ... show as needing to be added in the "Pending changes" window....
Read more >
EF Migrations not able to remove migration
I have 5 migrations, but the 5th has been created on accident. It doesn't hold any changes ( Up and Down methods are...
Read more >
Managing Migrations - EF Core
Adding, removing and otherwise managing database schema migrations with Entity Framework Core.
Read more >
Resetting Entity Framework Migrations to a clean Slate
This post describes the steps on how to remove existing migrations and create a new initial migration from the current schema.
Read more >
Entity Framework Core Migrations
Removing A Migration ... The following command removes a migration: ... You will use this command to remove the latest migration. This will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found