Reputation: 2871
In my asp net core 3.1-project, Im trying out MS Identity, by adding Authentication when I create a new template (Asp net core 3.1+react)
I was hoping to add my Identity tables to a different schema, using this simple Guide, ie
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.HasDefaultSchema("notdbo");
}
But when I run "Update database" in package manager, it still creates a database in dbo-schema
Upvotes: 1
Views: 995
Reputation: 19921
You need to add a valid migration first, before you do the Update-Database. The catch is that there is already one migration pending in the code, so that's why your change will not be detected.
Upvotes: 0
Reputation: 2394
Here is some reasons can cause this:
Option1:
Add-Migration
(as mentioned in the comment) - This creates a new migration class as per specified name with the Up() and Down() methods.Update-Database
Option2:
update-database
. This will Executes the last migration file created by the Add-Migration
command and applies changes to the database schema.Upvotes: 1