c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
asp.net MVC

Migrations are enabled for context, but the database does not exist or contains no mapped tables.

| | CSharp , MVC

Migrations are enabled for context, but the database does not exist or contains no mapped tables. Use Migrations to create the database and its tables, for example by running the 'Update-Database' command from the Package Manager Console.

The database is not getting created for the first time while running the asp.net mvc application. I got this above error migrations are enabled for context and use migration to create the database and its table.

Solution:

You can solve it manually via SQL management  Studio by running the Database schema.

Run the following command in the nuget package manager console.

PM> Update-Database –Script

 

This will generate a SQL file with Schema code. Create an empty database and run the database schema, tables get created on it.