mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
12 lines
347 B
Ruby
12 lines
347 B
Ruby
|
class RemoveUncategorizedParents < ActiveRecord::Migration
|
||
|
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
|