Alter topic creation date

Hi everyone,

I am writing because I am trying to populate my forum with posts made by a set of users on another old forum.

What I would like to do is to create these threads - and the subsequent posts they may have - keeping the original creation date.

Altering the “created_at” field at POST time does not work. I am working via the API.

TL;DR If a thread made on the old forum was posted on Oct 14, '11, at 07:45 am, how do I keep the original posting date&time when importing it into a new Discourse forum?

Thank you all for your help!


There are a load of example migration scripts in the core repo and some how to’s on here to exploit them - why use the API?

@merefield, thanks, I’ve seen some migration scripts, but for the time being, I’m using the API directly.
I’m just wondering whether what I want to do (pre-date a thread) is even possible at all on Discourse.

Try to passing the created_at variable more specific if you did not.

I just look into the Discourse source code, it using to parse your created_at date string, for your example, it result

pry(main)>"Oct 14, '11, at 07:45 am").to_s
=> "0011-10-14 07:45:00 UTC"

how about an RFC 3339 string

=> "2011-10-15 00:00:00 UTC"
1 Like

Thank you! That did the trick :slight_smile: