Skip to content

Commit

Permalink
[SOA-041][Feature] Automatically create the Database if NOT existing. (
Browse files Browse the repository at this point in the history
  • Loading branch information
LyQuocCuong authored Aug 7, 2023
1 parent ac40793 commit b59bc15
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public sealed class ShopOnlineContext : DbContext
{
public ShopOnlineContext(DbContextOptions<ShopOnlineContext> options)
: base (options)
{
{
RelationalDatabaseFacadeExtensions.Migrate(this.Database); // Auto create Database if NOT existing
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
Expand Down
2 changes: 1 addition & 1 deletion eShopOnlineApiHost/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
}
},
"ConnectionStrings": {
"eShopOnlineConnection": "server=.\\SQLEXPRESS; database=LQCStoreProd1; User=adminhenry ; Password=admin"
"eShopOnlineConnection": "server=.\\SQLEXPRESS; database=EShopOnlineDev; User=adminhenry ; Password=admin"
}
}
2 changes: 1 addition & 1 deletion eShopOnlineApiHost/appsettings.Production.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
}
},
"ConnectionStrings": {
"eShopOnlineConnection": "server=.\\SQLEXPRESS; database=LQCStore; Integrated Security=true"
"eShopOnlineConnection": "server=.\\SQLEXPRESS; database=EShopOnlineProd; Integrated Security=true"
}
}

0 comments on commit b59bc15

Please sign in to comment.