# Migrate a phpBB3 forum to Discourse

**URL:** https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810
**Category:** Migrating to Discourse
**Tags:** how-to
**Created:** [7월 5, 2015, 10:02오후 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810 "2015-07-05T22:02:57Z")
**Posts on this page:** 1
**Showing post:** 379

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [6월 20, 2018, 11:30오후 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/379 "2018-06-20T23:30:38Z")

</div>

Thank you, I’m going to work on this one.  
And sorry about the off topic!

Edit : my script worked well, so here’s how I did, in case it would interest some people who’d like to “unmerge” a category after reorganizing their phpbb topics into Discourse:

1. Installed [Discourse Data Explorer](https://meta.discourse.org/t/data-explorer-plugin/32566)
2. Get the Discourse imported posts from the category of your choice with this query and download the result as a json:

```SQL
SELECT
topics.id as d_topic_id,
slug,
value as phpbb_topic_id
FROM topics
JOIN topic_custom_fields
ON topic_id = topics.id
AND name = 'import_topic_id'
AND category_id = 5

```

3.Get the phpbb topic list from the category(ies) of your choice from phpmyadmin and export the result as a json:

```SQL
SELECT topic_id FROM phpbb_topics
JOIN phpbb_forums
ON phpbb_topics.forum_id = phpbb_forums.forum_id
AND phpbb_forums.forum_id = 20

```

Then you can loop iterate one of your json, and on each iteration if `phpbb_topic_id` is also present in the second array, then you can move it to a new category of your choice.  
To do so I used [GitHub - communiteq/discourse-api-php: PHP API client for Discourse · GitHub](https://github.com/communiteq/discourse-api-php) and added a method to update the category of a topic.

---

_[View the full topic](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810)._
