0

I am using EF Core code first approach and trying to configure signature strength of the column type ltree using the below snippet.

public class Node
{
    public Guid Id { get; set; }
    public LTree Path { get; set; }
    public string Name { get; set; }
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.HasPostgresExtension("ltree");
    modelBuilder.Entity<Node>().HasIndex(x => x.Path).HasMethod("gist");           

}

This just creates an index with the default signature length of 8 bytes. I want to override this signature length by explicitly specifying the length like as we do in the postgres query editor

CREATE INDEX "IX_Nodes_Path" ON public."Nodes" USING gist ("Path" gist_ltree_ops (siglen='100'))

Any pointers to achieve this will be of immense help.

I am using posgres version 14.0, EF Core 6 rc, npgsql 6 rc.

Nithin
  • 45
  • 7

1 Answers1

1

Unfortunately this isn't supported by the Fluent API - you'll have to edit your scaffolded migration and use raw SQL to express this.

The provider does have a Fluent API for specify the operator class, but not for specifying options (e.g. siglen).

Shay Rojansky
  • 15,357
  • 2
  • 40
  • 69