mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00

* It only imports users and emails so far * It stores mapped IDs and usernames in a SQLite DB. In the future, we might want to copy those into the Discourse DB at the end of a migration. * The importer is split into steps which can mostly be configured with a simple DSL * Data that needs to be shared between steps can be stored in an instance of the `SharedData` class * Steps are automatically sorted via their defined dependencies before they are executed * Common logic for finding unique names (username, group name) is extracted into a helper class * If possible, steps try to avoid loading already imported data (via `mapping.ids` table) * And steps should select the `discourse_id` instead of the `original_id` of mapped IDs via SQL
13 lines
340 B
Ruby
13 lines
340 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Migrations::Importer
|
|
StepStats =
|
|
Struct.new(:skip_count, :warning_count, :error_count) do
|
|
def reset(skip_count: 0, warning_count: 0, error_count: 0)
|
|
self.skip_count = skip_count
|
|
self.warning_count = warning_count
|
|
self.error_count = error_count
|
|
end
|
|
end
|
|
end
|