SeaQL / SeaQL/sea-orm

Schema-syncing more complex indexes

Open
#3,157 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help-wanted
Dominant language
Rust
Stars
9.9k
Forks
734
Avg merge
6h 36m
Merged PRs (30d)
8

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named; start by locating the schema-sync logic that drops indexes. Clarify whether the project will preserve manually created indexes or synchronize declared custom indexes, including partial and ordered composite indexes. Done means the chosen behavior is implemented without recreating or dropping unsupported indexes on every sync.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.