What is the correct way to post-create an index for an existing field? First I tried this:
public class People
{
[Index]
public string DisplayName { get; set; }
}
public override void Up()
{
Db.AlterColumn(x => x.DisplayName);
}
public override void Down()
{
Db.DropIndex(“idx_people_displayname”);
}
then the migration runs to the following error:
NamingStrategy is changed to OrmLiteNamingStrategy because otherwise ASP.NET Core Identity is not showing properly in Admin UI, I don’t know if this is causing the problem?
Best to just use a Db.ExecuteSql to handle the dropping of the index since currently there isn’t a way for the Postgres provider to override the default syntax around dropping an index. Something we’ll have to look into how to support this in a non disruptive way.
As for the Naming strategy and Admin UI, could you create a minimal reproduction of the issue you are experiencing and push it to a GitHub repository? That way we can take a look and hopefully resolve the problem.
I understand the issue now thanks for the reproduction. Since OrmLite is driving admin UI and the template was created with the default setup for EF Core, it doesn’t adhere to change in naming strategies without overriding the ApplicationDbContext and related ModelBuilder methods. Using OrmLiteNaming strategy to make your naming consistent across both is likely the path of least resistance since the API request uses the configured dialect and naming strategy to make the query when quoting the table name.