Skip to content

[Feature]: Add support for GIN indexes #487

@ThomasLandauer

Description

@ThomasLandauer

Problem Statement

GIN seems to be the recommended index for arrays & the like.

Proposed Solution

ORM\Index has an argument flags and options. Don't know what they are meant for - maybe they could be used:

#[ORM\Index(name: 'my_gin', fields: ['foo'], flags: ['GIN'], options: ['gin' => true])]

Feature Type

Framework Integration Enhancement

PostgreSQL Feature/Function/Type

No response

PostgreSQL Documentation Link

https://www.postgresql.org/docs/current/gin.html

Use Case

Needed (more or less) every time you add an array column ;-)

Example Usage

Alternatives Considered

If it's not possible (or you don't want) to support them, you could add a note to the docs:
When defining a normal index, Doctrine schema tool creates:

CREATE INDEX my_gin ON foobar (foo);

But you can manually change it to:

CREATE INDEX my_gin ON foobar USING GIN (foo);

Then schema tool won't notice the difference (i.e. doesn't try to "fix" the index on every run).

Contribution

No

Additional Context

I could create a PR for the docs.

Checklist

  • I have searched existing issues and discussions to ensure this feature hasn't been requested before
  • This feature is related to PostgreSQL-specific functionality for Doctrine

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions