Importing content after importing users


(Josh) #1

I imported users into a new forum and it’s live now. Everything is going well, but after the import we decided to import the content instead of leaving it in an archived section.

Is there a safe way to run the import on another server and then upload it to the live site?

For example:

  1. Download a backup of the live site.
  2. Put up a maintenance page.
  3. Import the backup into a local copy of Discourse (not running in Docker, but just from the Github repo).
  4. Create a backup from the local copy.
  5. “Restore” the live site (running in Docker) from the backup in step #4.

Does that sound like a good method, or should I create the other copy of Discourse in step #3 on another remote server using the Docker install? I prefer not to run the import on the production server.


(Stephen) #2

How long have the users been live on the new forum? Have many posts been created, or new users signed up?

You’re looking at a bit of pain either way, if it hasn’t been long and much hasn’t change the simplest would be just to do a full migration and of users and posts.


(Josh) #3

There are at least 75 new users and about 250 posts since the user migration. Do you think it would be more painful than restoring a backup? I modified the import script to map the old user IDs on the posts to the new user IDs in Discourse and reassign the posts to the new (smaller) category structure, so I think that part should work.

Example:

Instead of things like:

user_id: user_id_from_imported_user_id(row['uid']) || -1,

it will do something like:

user_id: drupal2discourse_id_hash[row['uid']] || -1,

(Jay Pfaffman) #4

That should work fine. Worst case it doesn’t and you just unfreeze the server. You can even do a trial run before you freeze the forum to do the real import.

Go for it.


(Josh) #5

Thanks, I’ll give it a try today.


(Josh) #6

Thanks again! I still need to do some cleanup today, but it worked (after a long battle), and everything is finally online.