2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-31 00:06:56 -04:00
|
|
|
class RemoveUncategorizedParents < ActiveRecord::Migration[4.2]
|
2014-07-15 15:19:17 -04:00
|
|
|
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
|