mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
IMPORT: create category definitions in import:ensure_consistency
task
This commit is contained in:
parent
54daa92c2d
commit
a20f58554b
@ -20,6 +20,7 @@ task "import:ensure_consistency" => :environment do
|
|||||||
update_users
|
update_users
|
||||||
update_groups
|
update_groups
|
||||||
update_tag_stats
|
update_tag_stats
|
||||||
|
create_category_definitions
|
||||||
|
|
||||||
log "Done!"
|
log "Done!"
|
||||||
end
|
end
|
||||||
@ -425,6 +426,11 @@ def update_tag_stats
|
|||||||
Tag.ensure_consistency!
|
Tag.ensure_consistency!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_category_definitions
|
||||||
|
log "Creating category definitions"
|
||||||
|
Category.where(topic_id: nil).each(&:create_category_definition)
|
||||||
|
end
|
||||||
|
|
||||||
def log(message)
|
def log(message)
|
||||||
puts "[#{DateTime.now.strftime("%Y-%m-%d %H:%M:%S")}] #{message}"
|
puts "[#{DateTime.now.strftime("%Y-%m-%d %H:%M:%S")}] #{message}"
|
||||||
end
|
end
|
||||||
|
@ -303,14 +303,6 @@ class BulkImport::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
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)
|
def create_user_emails(rows, &block)
|
||||||
create_records(rows, "user_email", USER_EMAIL_COLUMNS, &block)
|
create_records(rows, "user_email", USER_EMAIL_COLUMNS, &block)
|
||||||
end
|
end
|
||||||
@ -323,6 +315,9 @@ class BulkImport::Base
|
|||||||
def create_group_users(rows, &block)
|
def create_group_users(rows, &block)
|
||||||
create_records(rows, "group_user", GROUP_USER_COLUMNS, &block)
|
create_records(rows, "group_user", GROUP_USER_COLUMNS, &block)
|
||||||
end
|
end
|
||||||
|
def create_categories(rows, &block)
|
||||||
|
create_records(rows, "category", CATEGORY_COLUMNS, &block)
|
||||||
|
end
|
||||||
def create_topics(rows, &block)
|
def create_topics(rows, &block)
|
||||||
create_records(rows, "topic", TOPIC_COLUMNS, &block)
|
create_records(rows, "topic", TOPIC_COLUMNS, &block)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user