Creating a basic import script, what do I need


(kodab) #1

Hi guys,

I’m currently using a very simple self-made forum that I want to migrate to discourse. Now I can export the data from my current forum and format all the data into a clean .csv file. I wonder now, what do I need at a minimum to import the forumposts to discourse?

I’ve looked at the importscripts from phpbb, vanilla and others and noticed they are quite “heacy” for the simple .csv that I have. I just want to say hey, I want to import this post in this category from this user row-by-row without the needed for escaping or formatting something.

Is there a simple X / Y importscript to do this job that you guys know of? Thx. :slight_smile: love

(Dean Taylor) #2

I believe the Zoho importer demonstrates a basic CSV import example:
discourse/zoho.rb at master · discourse/discourse · GitHub

(kodab) #3

Thanks for the reaction @DeanMarkTaylor! :slight_smile: The importscript you’re refering to has a big disclaimer tho:

### The output of this importer is bad.
### Improving it means getting better quality export data from Zoho,
### or doing a lot more work on this importer.
### Consider leaving data in Zoho and starting fresh in Discourse.

Is this script usable than?

I also have access to the postgres db from discource. Where can I insert the posts / find the categories / what do I need to insert in postgresSQL at a minimum in which rows?

(Jay Pfaffman) #4

Does your self-made forum store its data in a CSV file?

If not, in my experience, it’s easiest pull your data from the database, not from a CSV file. You’ve got several kinds of data, users, topics, replies (maybe categories?). Working from one of the existing scripts is probably your best bet.

Also, no, you don’t want to access the database directly as you asked here.

(kodab) #5

Thank you very mutch for your reply, very helpful. :slight_smile: I’m going tru the vanilla_mysql.rb script at this moment and I’m modifying my sql table so it gets accepted by the imported script.