When I run the following command in package manage console(VS 2019). I get the following error.
Add-Migration InitialMigration
The name 'InitialMigration' is used by an existing migration.
PM>
can somebody throw light on this? I am trying to use one project which was used in other machine to learn and tweak this project. Actually this command need to sync database schema and application model classes. At the moment my project doesn't have db -
i only have VS files project which was taken from other machine.
i know basic C#, asp.net and a bit of asp.net core.
When I run the following command in package manage console(VS 2019). I get the following error.
Add-Migration InitialMigration
The name 'InitialMigration' is used by an existing migration.
PM>
can somebody throw light on this? I am trying to use one project which was used in other machine to learn and tweak this project. Actually this command need to sync database schema and application model classes. At the moment my project doesn't have db -
i only have VS files project which was taken from other machine.
i know basic C#, asp.net and a bit of asp.net core.
The migration name must be unique. Clearly, there is already a migration named "InitialMigration". As the error clearly states you must use a unique migration name.
Since you moved the code to a new machine, you need to decide if you are plan to use the same database or create a new database. Generally, a local DB when learning EF Core and in some cases development. All you have to do is update the database connection
string to point to the server where you want the database created. Next enter Update-Database in the package manager to create the database using the existing migration found in the project.
Member
5 Points
62 Posts
package manager console help needed using visual studio 2019
Apr 30, 2020 01:59 PM|sathyaav|LINK
When I run the following command in package manage console(VS 2019). I get the following error.
Add-Migration InitialMigration
The name 'InitialMigration' is used by an existing migration.
PM>
can somebody throw light on this? I am trying to use one project which was used in other machine to learn and tweak this project. Actually this command need to sync database schema and application model classes. At the moment my project doesn't have db - i only have VS files project which was taken from other machine.
i know basic C#, asp.net and a bit of asp.net core.
Cheers
Sathya
All-Star
53011 Points
23596 Posts
Re: package manager console help needed using visual studio 2019
Apr 30, 2020 02:20 PM|mgebhard|LINK
The migration name must be unique. Clearly, there is already a migration named "InitialMigration". As the error clearly states you must use a unique migration name.
Since you moved the code to a new machine, you need to decide if you are plan to use the same database or create a new database. Generally, a local DB when learning EF Core and in some cases development. All you have to do is update the database connection string to point to the server where you want the database created. Next enter Update-Database in the package manager to create the database using the existing migration found in the project.
Member
5 Points
62 Posts
Re: package manager console help needed using visual studio 2019
Apr 30, 2020 02:45 PM|sathyaav|LINK
many thanks. Update-Database InitialMigration worked.