DEV: Adds a basic importer for the IntermediateDB

* 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
This commit is contained in:
Gerhard Schlager
2025-04-07 17:06:20 +02:00
committed by Gerhard Schlager
parent 7c6b116dfd
commit 251cac39af
20 changed files with 744 additions and 4 deletions

View File

@ -9,10 +9,9 @@ module Migrations::CLI
end
def execute
::Migrations.load_rails_environment
::Migrations.load_rails_environment(quiet: true)
puts "Importing into Discourse #{Discourse::VERSION::STRING}"
puts "Extralite SQLite version: #{Extralite.sqlite3_version}"
::Migrations::Importer.execute
end
end
end