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
- How to Enable Virtualization in BIOS Security Settings in Intel Processors For Android Studio?
- Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it.
- AttributeError: 'NoneType' object has no attribute 'get_text' - Python
- ModuleNotFoundError: No module named 'openpyxl' - Python
- How to get thumbnail from vimeo video URL in Python?
- Remove all special characters, punctuation except spaces from string - Python
- OSError: cannot write mode RGBA as JPEG- Python
- expected str, bytes or os.PathLike object, not JpegImageFile - Python
Related Article