IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Case convention for PostgreSQL

Open aspramsh opened this issue 6 years ago • 7 comments

Hi all,

I am using Identity Server with PostgreSQL. I would like to know if there is a way to change naming convention from Pascal case to snake case?

aspramsh avatar Dec 11 '19 11:12 aspramsh

It's EF Core under the covers -- so the question is can you make that do what you want?

brockallen avatar Dec 11 '19 13:12 brockallen

I use this blog post for overriding NpgSQL naming conventions: https://andrewlock.net/customising-asp-net-core-identity-ef-core-naming-conventions-for-postgresql/ So can I override ConfigurationDbContext's and PersistedGrantDbContext's OnModelCreating method?

aspramsh avatar Dec 11 '19 14:12 aspramsh

I just provided a somewhat simiar example for clustering. You can see if it works for your NpgSQL config:

https://github.com/IdentityServer/IdentityServer4/issues/3770#issuecomment-564327555

brockallen avatar Dec 11 '19 18:12 brockallen

When I do that I get the following error: Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[IdentityServer4.EntityFramework.DbContexts.PersistedGrantDbContext]' while attempting to activate 'MyContext'.

aspramsh avatar Dec 11 '19 21:12 aspramsh

Ah yea, I see. That was more of a copy/paste typo as I tried to write up that comment. Can you try:

public MyDbContext(DbContextOptions<MyDbContext> options, OperationalStoreOptions storeOptions) : base(options, storeOptions)

instead?

brockallen avatar Dec 11 '19 21:12 brockallen

I have generated migrations successfully, thanks a lot.

aspramsh avatar Dec 11 '19 22:12 aspramsh

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 11 '20 11:01 lock[bot]