Skip to content

Conversation

@RParkerHp
Copy link

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Sorts tag indexes so code is generated in a stable and consistent manner.

User Case Description

For generated entities that have multiple database indexes associated with them, the ordering of indexes changes on each generation attempt. It therefore means the generated code contains a larger set of changes than is necessary when committed to source control.

Copy link

@propel-code-bot propel-code-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, ship it! 🚢

Details
Why was this auto-approved?
APPROVED: No issues detected.

@propel-code-bot
Copy link

propel-code-bot bot commented Dec 29, 2025

Ensure deterministic ordering of generated index tags

Introduces deterministic ordering for index-driven GORM tags by sorting column indexes by Name() before tag construction. A dedicated helper on *Index slices provides nil-tolerant name-based ordering so generated struct tags remain stable across runs.

Key Changes

• Added helper sortIndexesByName in internal/model/tbl_index.go to sort *Index slices by Name() while handling nil entries
• Invoked sortIndexesByName on c.Indexes within Column.buildGormTag before assembling index-related tag values
• Updated imports in internal/model/tbl_index.go to include sort and strings for the new sorting logic

Affected Areas

internal/model/tbl_index.go
internal/model/tbl_column.go

This summary was automatically generated by @propel-code-bot

@RParkerHp RParkerHp closed this Dec 29, 2025
@RParkerHp RParkerHp deleted the sort-index-tags branch December 29, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants