# Pre-migration evaluation for a large Drupal 7 forum

**URL:** https://meta.discourse.org/t/pre-migration-evaluation-for-a-large-drupal-7-forum/241743
**Category:** Migration
**Tags:** drupal
**Created:** [October 12, 2022, 10:06pm UTC](https://meta.discourse.org/t/pre-migration-evaluation-for-a-large-drupal-7-forum/241743 "2022-10-12T22:06:58Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [October 13, 2022, 2:40pm UTC](https://meta.discourse.org/t/pre-migration-evaluation-for-a-large-drupal-7-forum/241743/2 "2022-10-13T14:40:21Z")

</div>

> [@rahim123](#):
>
> **Post format conversion:** Unfortunately the current forum uses a mix of pure HTML and Textile formatted posts. […] So I’ve thought about just doing some kind of offline find/replace on the database dump file with `sed` , similar to what is described [here](https://tonyteaches.tech/how-to-do-a-mysql-find-and-replace-on-the-entire-database/). Suggestions or solutions would be welcome.

I just ran across this:  
[https://github.com/dandv/discourse-post-process](https://github.com/dandv/discourse-post-process)

> apply a set of regexp-based transformations, such as replacing [BBCode](https://en.wikipedia.org/wiki/BBCode) tags with Markdown

It was last updated in 2016, not sure if it’s still a relevant option.

* * *

> [@rahim123](#):
>
> **Permalinks:**

> [@Redirect old forum URLs to new Discourse URLs using permalinks](https://meta.discourse.org/t/redirect-old-forum-urls-to-new-discourse-urls/20930):
>
> Redirecting Old Forum URLs to New Discourse URLs using permalinks If you’ve moved from other forum software to Discourse using [one of our import scripts](https://github.com/discourse/discourse/tree/main/script/import_scripts), then you probably want all your hard-earned Google search results to continue pointing to the same content. Discourse has a built-in way to handle this for you as an alternative to writing nginx rules, using the permalinks lookup table. The permalinks table allows you to set two things: a url to match, and what that url should show. There a…

> [@Redirect old forum URLs to new Discourse URLs using permalinks](https://meta.discourse.org/t/redirect-old-forum-urls-to-new-discourse-urls-using-permalinks/20930/21):
>
> Patch the importer to output lines that end up creating a [map file](https://gist.github.com/dandv/f6476574118d079b9063) to use for for nginx’s [map module](http://serverfault.com/questions/441235/maintaining-redirects-in-nginx-from-an-external-source/441517#441517)

Is this still relevant? In the Drupal importer script I’m seeing code like:

```plaintext
 create_posts(results, total: total_count, offset: offset) do |row|
        topic_mapping = topic_lookup_from_imported_post_id("nid:#{row['nid']}")

```

```plaintext
 def create_permalinks
    puts '', 'creating permalinks...'

    Topic.listable_topics.find_each do |topic|
      begin
        tcf = topic.custom_fields
        if tcf && tcf['import_id']
          node_id = tcf['import_id'][/nid:(\d+)/, 1]
          slug = "/topic/#{node_id}"
          Permalink.create(url: slug, topic_id: topic.id)
        end

```

---

_[View the full topic](https://meta.discourse.org/t/pre-migration-evaluation-for-a-large-drupal-7-forum/241743)._
