Skip to content

fix(store): add migration to normalize tag case#5426

Closed
majiayu000 wants to merge 1 commit intousememos:mainfrom
majiayu000:fix/5363-hashtag-case-normalization
Closed

fix(store): add migration to normalize tag case#5426
majiayu000 wants to merge 1 commit intousememos:mainfrom
majiayu000:fix/5363-hashtag-case-normalization

Conversation

@majiayu000
Copy link
Contributor

Summary

  • Adds a one-time data migration to normalize all existing memo tags to lowercase
  • Fixes duplicate tags issue where old memos have mixed-case tags (e.g., #House) while new memos use lowercase (#house)
  • Migration runs on server startup and is tracked via system_setting to prevent re-execution

Fixes #5363

Test plan

  • Tested with SQLite, MySQL, PostgreSQL databases
  • Verified migration only runs once
  • Verified tags are normalized to lowercase
  • All existing tests pass

Add a data migration that runs on server startup to normalize all
existing memo tags to lowercase. This prevents duplicate tags when
old memos have mixed-case tags (e.g., #House) while new memos
automatically use lowercase (e.g., #house).

The migration:
- Runs once and is tracked via system_setting
- Processes memos in batches to avoid memory issues
- Deduplicates tags during normalization
- Skips memos that already have lowercase tags

Fixes usememos#5363

Signed-off-by: majiayu000 <1835304752@qq.com>
@boojack boojack force-pushed the main branch 2 times, most recently from a196c72 to 71e8a06 Compare February 10, 2026 01:15
@boojack boojack self-requested a review as a code owner February 24, 2026 14:23
@boojack boojack force-pushed the main branch 2 times, most recently from 2b6b987 to 47d9414 Compare February 24, 2026 14:55
@boojack boojack added the Stale label Mar 4, 2026
@boojack boojack closed this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hashtags are being saved in lower case, leading to duplicate hashtags of the same name

2 participants