-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Description
Feature Description
In PostgreSQL, hash indexes can be highly efficient for certain types of lookups, especially for equality comparisons.
However, currently, TypeORM does not provide a straightforward way to create hash indexes through its decorators or schema synchronization features.
This limitation requires developers to manually manage hash indexes via raw SQL queries in migrations
The Solution
It would be beneficial if TypeORM could natively support the creation of hash indexes for PostgreSQL. This could be achieved by extending the @Index decorator or providing a new option within the @Column decorator to specify the type of index.
Example:
@Entity()
export class Structure {
@PrimaryGeneratedColumn()
id: number;
@Column({ type: 'text', nullable: false })
@Index({ type: 'hash' })
public region: string;
}Considered Alternatives
Create indexes one by one with custom queries
Additional Context
No response
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqlite-abstract
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.