Skip to content

fix(databases): correct enum icon and hide indexed checkbox for relationships#3114

Merged
HarshMN2345 merged 2 commits into
mainfrom
fix-index-column-icons-and-relationship-checkbox
Jul 10, 2026
Merged

fix(databases): correct enum icon and hide indexed checkbox for relationships#3114
HarshMN2345 merged 2 commits into
mainfrom
fix-index-column-icons-and-relationship-checkbox

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

Summary

  • Fix wrong icon shown for enum columns in the create-index field selector — the lookup matched by type only, and since email/ip/url/enum/string columns all share type: 'string', it always resolved to the first match (Email's mail icon) instead of the enum-specific icon.
  • Hide the "Indexed" checkbox for relationship columns in the columns table, since relationship columns cannot be indexed (consistent with existing filtering in the create-index field list and the "Create index" action menu item).

Test plan

  • Open a table with an enum column, start "Create index", confirm the field selector shows the correct enum icon
  • Open a table with a relationship column, confirm the "Indexed" checkbox no longer appears for that column in the columns list
  • bun run check / bun run lint pass for the touched files

…ionships

The create-index column selector matched icons by type only, so enum
columns (type: string, format: enum) fell through to the first
string-typed option and showed the email icon. The columns table also
showed an "Indexed" checkbox for relationship columns, which can't be
indexed.
@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two display bugs in the database table UI. The icon lookup in the create-index field selector now matches on both type and format, so enum/email/ip/url columns each show their correct icon instead of all resolving to Email's mail icon. The "Indexed" checkbox is hidden for relationship columns, which cannot be indexed, making the columns table consistent with the existing filtering in the create-index sheet and the action menu.

  • Icon fix (create.svelte): The baseColumnOptions.find now requires option.format === (field.format || undefined), mirroring the identical guard already in +page.svelte (line 407) and correctly disambiguating the five type: 'string' variants.
  • Relationship checkbox (+page.svelte): Wraps the indexed Selector.Checkbox in {#if !isRelationship(column)}, using the already-imported helper that's consistently applied elsewhere in the same file.

Confidence Score: 5/5

Both changes are narrowly scoped UI fixes with no data mutations; safe to merge.

The icon lookup change correctly mirrors the existing guard already in use in the columns page, and the relationship checkbox hide uses a well-tested helper applied consistently throughout the file. No logic paths, data flows, or API calls are altered.

No files require special attention.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/views/indexes/create.svelte Adds format-based disambiguation to the leadingIcon lookup so enum/email/ip/url columns each resolve their correct icon instead of always matching Email first. Logic is now consistent with the identical guard already used in +page.svelte.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/+page.svelte Wraps the "Indexed" checkbox in {#if !isRelationship(column)} so the cell is empty for relationship columns, using the already-imported helper consistent with other guards in the same file.

Reviews (2): Last reviewed commit: "fix(databases): treat empty format as no..." | Re-trigger Greptile

Mirrors the truthiness guard already used in columns/+page.svelte, so
an empty-string format from the API falls back to undefined instead of
failing to match any option and dropping the icon.
@HarshMN2345 HarshMN2345 merged commit c2b07b0 into main Jul 10, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the fix-index-column-icons-and-relationship-checkbox branch July 10, 2026 06:11
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