Skip to content

Schema-syncing more complex indexes #3157

Description

@TomashuTTTT7

Motivation

The macro for creating models/entities is very useful, but quite limited when it comes to declaring more complex indexes.
Some problems include:

  • there is no way to create a partial index
  • there is no way to create a composite index without it being unique (unique_key)
  • the order of columns inside composite indexes matters

I don't expect the macro to support more advanced use cases, but there should be a way to specify them manually. But it's problematic with entity-first approach and schema syncing - even if you create the index yourself afterwards, the index would be dropped on the next schema sync, and the index would need to be created every time from scratch.

Proposed Solutions

  • don't drop index on schema sync, or add an option for it.
  • add a possibility to specify custom indexes to synchronize

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions