2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-03 22:05:52 +08:00
discourse/spec/db/migrate
Natalie Tay d1740ab499
DEV: Add slugs to tag model (#36985)
We're adding `slug` to the `Tag` model so that we can move URLs away
from the `/tag/name` convention to `/tag/slug/id`.

This commit only includes adding the column in the database, a migration,
and ActiveRecord validation. For extra info to the reviewer, this is a
list of scenarios for how slugs are generated in categories, in the tag
migration, and tag model:

| scenario | category | tag (migration) | tag (model) |

|-----------------------------------|------------------|------------------|------------------|
| normal ("Turkish Angora") | "turkish-angora" | "turkish-angora" |
"turkish-angora" |
| numeric-only ("123") | "" | "" | "" |
| unicode-only ("猫") | "" | "" | "" |
| unicode mixed ("turkish猫angora") | "turkish-angora" | "turkish-angora"
| "turkish-angora" |
| special chars ("turkish@angora!") | "turkish-angora" |
"turkish-angora" | "turkish-angora" |
| special chars only ("@#$%") | "" | "" | "" |
| conflict | "" | "" | "" |

All empty slugs use slug_for_url → "#{id}-tag" for URLs. This is similar
to how categories work to keep consistent. This PR contains 2
migrations, slug generation and index creation. The migration spec
doesn't allow for "CONCURRENT" index creation, so we are separating them
to make things easier to test.
2026-01-08 11:03:01 +08:00
..
.gitkeep
20250714010001_backfill_themeable_site_settings_spec.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
20250902072941_sync_timerable_id_topic_id_spec.rb
20251024015907_populate_image_quality_setting_spec.rb FEATURE: Add new, unified image_quality site setting (#35467) 2025-10-29 13:17:28 +08:00
20260106060807_add_slug_to_tags_spec.rb DEV: Add slugs to tag model (#36985) 2026-01-08 11:03:01 +08:00