# Database reload

**URL:** https://meta.discourse.org/t/database-reload/342655
**Category:** Migration
**Created:** [December 16, 2024, 1:52pm UTC](https://meta.discourse.org/t/database-reload/342655 "2024-12-16T13:52:53Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [December 16, 2024, 1:52pm UTC](https://meta.discourse.org/t/database-reload/342655/1 "2024-12-16T13:52:53Z")

</div>

I have a large phpbb database I am migrating. I want to do most of the migration while the old site remains active. Then, on migration weekend, rerun the migration script after reloading the database. This will reduce the migration weekend only to import a couple of thousand user posts versus 300,000.

1. is this feasible? Does the migration script maintain the restart points outside the MySQL database?
2. is there an easy way to make the script upload a new database dump without resetting the previous work or duplicating it?

Any best practices or suggestions would be welcomed.

---

<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: [December 16, 2024, 3:07pm UTC](https://meta.discourse.org/t/database-reload/342655/2 "2024-12-16T15:07:54Z")

</div>

> [@LotusJeff](#):
>
> Does the migration script maintain the restart points outside the MySQL database?

Yes, the [phpbb import script](https://github.com/discourse/discourse/tree/main/script/import_scripts/phpbb3) supports that. Simply rerun the script after loading your updated sql database. It will skip existing content and add what’s missing to Discourse.

---

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [December 16, 2024, 5:02pm UTC](https://meta.discourse.org/t/database-reload/342655/3 "2024-12-16T17:02:51Z")

</div>

Thank you for your reply. Clarification on the reply of “after loading your updated SQL database.”

Does this mean the import script will automagically recognize a new dump file and will update the database? Or does this mean, I need to refresh the database with updated data manually?

---

<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: [December 16, 2024, 5:28pm UTC](https://meta.discourse.org/t/database-reload/342655/4 "2024-12-16T17:28:46Z")

</div>

You need to delete the older database from MySQL, import your latest sql file as a new database, and run the import script which will load the newest database.

The script will iterate through all the database content, detect if some content (users, posts, etc.) already exists in Discourse, and will import only the new data.

---

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [December 16, 2024, 5:43pm UTC](https://meta.discourse.org/t/database-reload/342655/5 "2024-12-16T17:43:34Z")

</div>

Thank you for that clarification.

---

<div class="post-metadata">

### Author: ![deepvyas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deepvyas/32/475161_2.png) [@deepvyas](https://meta.discourse.org/u/deepvyas)
#### Post date: [December 26, 2024, 11:38am UTC](https://meta.discourse.org/t/database-reload/342655/6 "2024-12-26T11:38:58Z")

</div>

> [@Canapin](#):
>
> The script will iterate through all the database content, detect if some content (users, posts, etc.) already exists in Discourse, and will import only the new data.

@Canapin thanks for your instructions to migration, just an query incase if records gets delete(ex: product or product option deleted) from the table.

Does the script update those rows of table?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [December 26, 2024, 12:24pm UTC](https://meta.discourse.org/t/database-reload/342655/7 "2024-12-26T12:24:39Z")

</div>

> [@deepvyas](#):
>
> just an query incase if records gets delete(ex: product or product option deleted) from the table.
> 
> Does the script update those rows of table?

No, and it will also not detect updates (edits) to posts and users.

---

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [January 20, 2025, 5:28pm UTC](https://meta.discourse.org/t/database-reload/342655/8 "2025-01-20T17:28:46Z")

</div>

To provide an update. I performed my phpBB migration in a two step method.

### First Migration

While my current phpBB system was still in productions state I did the following:

- Followed the standard phpBB migration guideline
- Took a sql dump of my current phpBB database
- Copied over all files and avatars.

This allowed me to migrate the majority of data and test everything out with real data. After validating the data and setting up the new Discourse system. I moved on to a second migration activity.

### Second Migration

This time I shut down my phpBB forum.

I ran the import script a second time:

- Updated the files and avatars with any new files since first migration.
- Replaced the mysql dump with a new dump file.

I ran the import script. Since the process only had to import a couple of weeks worth of data, the script took less than 15 minutes.

Everything ran smoothly.

If you have a large phpBB forum to migrate, I highly recommend the two phase approach for migration.
