Migrate specific Xenforo content

AI-generated summary

The discussion revolves around migrating specific XenForo content to Discourse. Ventrilo wants to import threads and their first posts, while reassigning the thread starters to a different Discourse user account. RGJ provided a solution by modifying the SQL import script to include AND p.post_id = t.first_post_id in the WHERE clause and changing the user_id assignment.

However, Ventrilo encountered SQL validation errors and couldn’t find the import script. Ventrilo expressed frustration and inquired about paid support for this type of migration. Firepup650 suggested creating a topic in the Marketplace for assistance. Ventrilo is now experiencing an error with the environment file in the import script, which is not mentioned in any migration tutorials.

Hi Discourse comm,

I have a lot of content from an old xenforo database that I want to import, but I don’t want to do a few things:

Ideally, I only want to import the threads and the first post from each thread, I also want to re-assign the thread starter to a different discourse forum/user account that I’ve already created. is this possible in an easy-enough way?

just modify the SQL in the import script

        SELECT p.post_id id,
               t.thread_id topic_id,
               #{@prefix_as_category ? "t.prefix_id" : "t.node_id"} category_id,
               t.title title,
               t.first_post_id first_post_id,
               t.view_count,
               p.user_id user_id,
               p.message raw,
               p.post_date created_at
        FROM #{TABLE_PREFIX}post p,
             #{TABLE_PREFIX}thread t
        WHERE p.thread_id = t.thread_id
        AND p.message_state = 'visible'
        AND t.discussion_state = 'visible'
        ORDER BY p.post_date
        LIMIT #{BATCH_SIZE}" # needs OFFSET

add AND p.post_id = t.first_post_id to the WHERE clause

Change

mapped[:user_id] = user_id_from_imported_user_id(m["user_id"]) || -1

to

mapped[:user_id] = xxx

where xxx is the Discourse user ID you want to assign the topics to.

@RGJ thanks for the quick response, you couldn’t happen to show me the SQL statement with the correct4 edit, ive tried including the AND p.post_id = t.first_post_id to the where clause but im getting SQL validation errors on the statment

oh and where is this import script?! thanks for spoonfeeding me i appreciate it

Spent hours trying and got no where really, is there no paid support with discourse for this type of thing?

You could probably make a topic in Marketplace.

So I’m getting this error:

cannot load such file – /var/discourse/config/environment

and in base.rb line 16 this exists:

require_relative “../../config/environment”

nothing in any import/migraton tutorial mentions the fact this doesn’t exist