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.
Post your comments / questions
Recent Article
- Import "django.shortcuts" could not be resolved from source in Django Project
- How to add two numbers in Android Studio? | Source Code
- FindViewByID returns null in android studio -SOLVED
- Saving changes is not permitted in SQL SERVER - [SOLVED]
- Restore of database failed. File cannot be restored over the existing. -[SOLVED]
- One or more projects in the solution were not loaded correctly in Visual Studio 2019 | FIXED
- How to find Laptop's Battery Health?
- SOLVED-Related Field got invalid lookup: icontains error in Django
Related Article