JasperFx / marten

.NET Transactional Document DB and Event Store on PostgreSQL
https://martendb.io
MIT License
2.87k stars 457 forks source link

Add functionality to allow custom indexes with multiple fields including meta data #3557

Open Martin-Kleinbooi-AbsaAfrica opened 1 week ago

Martin-Kleinbooi-AbsaAfrica commented 1 week ago

Hi there

It would be nice to have the ability to able to have the control over creating indexes with custom columns which includes meta data and table definition data.

Currently one can only specify either table definition data or meta data indexes.

Reason for this would for e.g. be on partitioning. When a partition is created unique indexes logic breaks because it requires both the mt_deleted field + table definition columns.

jeremydmiller commented 1 week ago

You could do this today if the API just gave you access to the full IndexDefinition model. I think I'd rather make Marten smart enough to "know" what fields are required for partitioned tables and adds those to unique indexes automatically

Happy to have a pull request if you wanna take on the easier first suggestion up there

Martin-Kleinbooi-AbsaAfrica commented 1 day ago

That would be great