How to remove double quotes from the table and column names in the system when using pgSQL in abp vnext
How to remove double quotes from the table and column names in the system when using pgSQL in abp vnext. For example, if the system defaults to: select "TenantId" from "AbpUser", I would like the system to use : select tenant Id from abpuser . Because my database table and column names are created in lowercase
My system database was migrated from SQL SERVER, and after migration, it indicates that both the database and column names are lowercase without double quotes.
hi
My system database was migrated from SQL SERVER
You can delete all existing migration files and recreate new pgsql migrations.
Hi From what I have seen, even if you recreate the migration you will still get double quotes in pgqsl. This is super annoying but Postgres is case sensitive (TenantId != tenantid). NpgSql will translate all camel case tables and fields to be double quoted.
Only solution if found is to snake case my own modules tables and fields but existing core abp module will fail at runtime if you force a lowercase or another naming convention because each module have their own dbContext which is unaware of the changes.
hi
You found the wrong solution.
Please test your code in plain ef core project.
@maliming reviving this issue since there are new overriding features for abpdbcontext. Do you mind posting a small howto on removing double quotes in postgres by overriding the name to snake case?
I have been trying to use these function but the Migration project is not working
options.DefaultConventionAction = (dbContext, builder) =>
{
// This action is called for ConfigureConventions method of all DbContexts.
};
options.ConfigureConventions<YourDbContext>((dbContext, builder) =>
{
// This action is called for ConfigureConventions method of specific DbContext.
});
options.DefaultOnModelCreatingAction = (dbContext, builder) =>
{
// This action is called for OnModelCreating method of all DbContexts.
};
options.ConfigureOnModelCreating<YourDbContext>((dbContext, builder) =>
{
// This action is called for OnModelCreating method of specific DbContext.
});
Can we use options.ConfigureOnModelCreating along with naming conventions to get this done?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.