mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FIX: Add unique index to prevent duplicate slugs for categories
This commit is contained in:
@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddUniqueIndexCategoriesOnSlug < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_index(
|
||||
:categories,
|
||||
'COALESCE(parent_category_id, -1), slug',
|
||||
name: 'unique_index_categories_on_slug',
|
||||
unique: true
|
||||
)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user