emonney / QuickApp

ASP.NET Core / Angular startup project template with complete login, user and role management. Plus other useful services for Quick Application Development
https://www.ebenmonney.com/quickapp
MIT License
1.26k stars 594 forks source link

database for this app #96

Closed dineshthigale closed 5 years ago

dineshthigale commented 6 years ago

how create the database for this quick app?

liphis commented 6 years ago

If you have LocalDB installed (with Visual Studio), a LocalDB database will be created by applying the migration on Run. See Program.cs -> databaseInitializer.SeedAsync().Wait(); Initial migration is provided in the sources. If you want to use another type db, you'll have to regenerate the migrations file after you change the DefaultConnection string in appsettings.json

idontbyte commented 6 years ago

Here are the steps I took to use full SQL Server database:

  1. Create new blank database in SQL Express or SQL Server.
  2. Change connection string in appsettings.json / appsettings.Development.json
  3. Add a migration in package manager console by using the command: add-migration "migration name"
  4. Apply tables to database in package manager console by using the command: update-database
emonney commented 5 years ago

For Ms SQL type databases (SQL Express, SQL Server, LocalDB, ...) what you have to do is make sure the connection string points to the database of your choice and the credentials used has the rights to create databases and tables on the target server. You then run your application and everything will be created for you automatically using migrations. Other database types might involve some modifications based on the specifics of that db type.