mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 08:46:19 +08:00
14 lines
383 B
Ruby
14 lines
383 B
Ruby
# frozen_string_literal: true
|
|
|
|
class RemoveUncategorizedParents < ActiveRecord::Migration[4.2]
|
|
def up
|
|
uncat = execute("SELECT value FROM site_settings WHERE name = 'uncategorized_category_id'")
|
|
if uncat && uncat[0] && uncat[0]["value"]
|
|
execute "UPDATE categories SET parent_category_id = NULL where id = #{uncat[0]["value"].to_i}"
|
|
end
|
|
end
|
|
|
|
def down
|
|
end
|
|
end
|