Open a PowerShell Command Prompt and navigate through the project’s root folder, which is as follows in our example:
C:ProjectsTestMakerFreeTestMakerFreeWebApp
Once there, type the following command to add the first migration:
dotnet ef migrations add "Initial" -o "DataMigrations"
The optional -o parameter can be used to change the location where the migration code-generated files will be created; if we don’t specify it, a root-level /Migrations/ folder will be created and used as default. Since we put all the EntityFrameworkCore classes into the /Data/ folder, it’s advisable to store migrations there as well.
The command should give the on-screen output below:
Wait for the migration to be created, and then type the following to apply it:
dotnet ef database update
Once done, open the Server Object Explorer and verify that the TestMakerFree Database has been created, along with all the relevant tables:
If we go back to Visual Studio and take a look at our project's Solution Explorer, we can see that there’s a new /Data/Migrations/ folder containing the EF Core code-generated files.