A platform for community discussion. Free, open, simple.
IMPORT: create category definitions in `import:ensure_consistency` task
Arpit Jalana20f58554b41
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rakeindex b3130146e35..936232ed98d 100644--- a/lib/tasks/import.rake+++ b/lib/tasks/import.rake@@ -20,6 +20,7 @@ task "import:ensure_consistency" => :environment doupdate_usersupdate_groupsupdate_tag_stats+ create_category_definitionslog "Done!"end@@ -425,6 +426,11 @@ def update_tag_statsTag.ensure_consistency!end+def create_category_definitions+ log "Creating category definitions"+ Category.where(topic_id: nil).each(&:create_category_definition)+end+def log(message)puts "[#{DateTime.now.strftime("%Y-%m-%d %H:%M:%S")}] #{message}"enddiff --git a/script/bulk_import/base.rb b/script/bulk_import/base.rbindex 89cc9480ab3..3212702d0df 100644--- a/script/bulk_import/base.rb+++ b/script/bulk_import/base.rb@@ -303,14 +303,6 @@ class BulkImport::Baseendend- def create_categories(rows, &block)- create_records(rows, "category", CATEGORY_COLUMNS, &block)-- Category.where(topic_id: nil).each do |c|- c.create_category_definition- end- end-def create_user_emails(rows, &block)create_records(rows, "user_email", USER_EMAIL_COLUMNS, &block)end@@ -323,6 +315,9 @@ class BulkImport::Basedef create_group_users(rows, &block)create_records(rows, "group_user", GROUP_USER_COLUMNS, &block)end+ def create_categories(rows, &block)+ create_records(rows, "category", CATEGORY_COLUMNS, &block)+ enddef create_topics(rows, &block)create_records(rows, "topic", TOPIC_COLUMNS, &block)end