You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GORM should allow specifying custom index options in struct annotations. Currently, when defining an index using the gorm:"index" tag, GORM only allows specifying the index type (e.g., GIN, BTREE) inside parentheses but does not support adding additional options for more advanced configurations.
For example, some databases allow specifying additional operator classes or storage parameters when creating an index, but GORM does not currently provide a way to include these options within the annotation.
Example of a query that cannot be fully represented using GORM's current struct tags:
CREATEINDEXIF NOT EXISTS idx_users_metadata ON users USING GIN (metadata jsonb_path_ops);
GORM only includes the index type (GIN) but does not allow jsonb_path_ops to be included inside the parentheses.
Motivation
Improved Flexibility: Many databases support additional index options that can optimize query performance, but GORM does not currently allow specifying them.
Better Performance: Certain indexing options can significantly enhance efficiency, especially for complex data types such as JSONB, array columns, and full-text search.
Schema Management Consistency: Without support for custom index options, users are forced to manually execute raw SQL migrations, which goes against the purpose of using GORM for schema management.
Related Issues
None.
The text was updated successfully, but these errors were encountered:
Describe the feature
GORM should allow specifying custom index options in struct annotations. Currently, when defining an index using the gorm:"index" tag, GORM only allows specifying the index type (e.g., GIN, BTREE) inside parentheses but does not support adding additional options for more advanced configurations.
For example, some databases allow specifying additional operator classes or storage parameters when creating an index, but GORM does not currently provide a way to include these options within the annotation.
Example of a query that cannot be fully represented using GORM's current struct tags:
If trying to define this in GORM:
GORM only includes the index type (GIN) but does not allow jsonb_path_ops to be included inside the parentheses.
Motivation
Improved Flexibility: Many databases support additional index options that can optimize query performance, but GORM does not currently allow specifying them.
Better Performance: Certain indexing options can significantly enhance efficiency, especially for complex data types such as JSONB, array columns, and full-text search.
Schema Management Consistency: Without support for custom index options, users are forced to manually execute raw SQL migrations, which goes against the purpose of using GORM for schema management.
Related Issues
None.
The text was updated successfully, but these errors were encountered: