I have been through the similar question but it does not solve my problem.
I have implemented reference tokens in IdentityServer4.
Now, I want to store the tokens in the EF Core database.
For that I have changed my AddIdentityServer() method with below changes:
.AddOperationalStore(options =>
{
options.DefaultSchema="idsrv";//This does not work.
options.ConfigureDbContext = builder =>
builder.UseSqlServer(configuration["ApexDatabaseSettings:ConnectionString"],
sql => sql.MigrationsAssembly(migrationsAssembly));
// this enables automatic token cleanup. this is optional.
options.EnableTokenCleanup = true;
options.TokenCleanupInterval = 3600; // interval in seconds (default is 3600)
});
After above changes I created a migration with the dotnet ef migrations add command.
Then I applied the migrations in my database with dotnet ef database update command.
I was expecting the migration to create a new database schema. Something like idsrv.PersistedGrants.
But it created dbo.PersistedGrants.
And when I ran the project it threw the EF Core Error that the idsrv schema is not recognized.
I was expecting that the new tables would set the db schema as idsrv but they didn't.
If I want the PersistedGrants and other tables of IdentityServer to be in that schema how can I do it?
Is it a good practice to have different db schema for IdentityServer4 Operational Tables?
Notice the DeviceCodes and PersistedGrants table in the screenshot.