# במהלך שחזור: "EXCEPTION: אתה מנסה לשחזר גרסה עדכנית יותר של הסכימה. עליך להגר קודם!"

**URL:** https://meta.discourse.org/t/during-restore-exception-youre-trying-to-restore-a-more-recent-version-of-the-schema-you-should-migrate-first/221800
**Category:** Support
**Created:** [23 במרץ,‏ 2022,‏ 6:51pm UTC](https://meta.discourse.org/t/during-restore-exception-youre-trying-to-restore-a-more-recent-version-of-the-schema-you-should-migrate-first/221800 "2022-03-23T18:51:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Joaquin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joaquin/32/254084_2.png) [@Joaquin](https://meta.discourse.org/u/Joaquin)
#### Post date: [23 במרץ,‏ 2022,‏ 6:51pm UTC](https://meta.discourse.org/t/during-restore-exception-youre-trying-to-restore-a-more-recent-version-of-the-schema-you-should-migrate-first/221800/1 "2022-03-23T18:51:30Z")

</div>

I recently set up a Discourse server, after spending some time on a trial ([trydiscourse.com](http://trydiscourse.com)). When I set it up, I downloaded a backup of the data from our trial from [trydiscourse.com](http://trydiscourse.com), and was able to restore that data on our self-hosted Discourse.

About a week later, when the trial was ending, I downloaded another backup from [trydiscourse.com](http://trydiscourse.com) and tried to restore. This time. the restore failed. Here are the logs:

```plaintext
[2022-03-05 01:31:08] [STARTED]

[2022-03-05 01:31:08] 'Joaquin' has started the restore!

[2022-03-05 01:31:08] Marking restore as running...

[2022-03-05 01:31:08] Making sure /var/www/discourse/tmp/restores/default/2022-03-05-013108 exists...

[2022-03-05 01:31:08] Copying archive to tmp directory...

[2022-03-05 01:31:08] Unzipping archive, this may take a while...

[2022-03-05 01:31:08] Extracting dump file...

[2022-03-05 01:31:08] Validating metadata...

[2022-03-05 01:31:08] Current version: 20220220234155

[2022-03-05 01:31:08] Restored version: 20220223161000

[2022-03-05 01:31:08] EXCEPTION: You're trying to restore a more recent version of the schema. You should migrate first!

[2022-03-05 01:31:08] /var/www/discourse/lib/backup_restore/meta_data_handler.rb:31:in `validate'

/var/www/discourse/lib/backup_restore/restorer.rb:112:in `validate_backup_metadata'

/var/www/discourse/lib/backup_restore/restorer.rb:43:in `run'

/var/www/discourse/script/spawn_backup_restore.rb:23:in `restore'

/var/www/discourse/script/spawn_backup_restore.rb:36:in `block in <main>'

/var/www/discourse/script/spawn_backup_restore.rb:4:in `fork'

/var/www/discourse/script/spawn_backup_restore.rb:4:in `<main>'

[2022-03-05 01:31:08] Trying to rollback...

[2022-03-05 01:31:08] There was no need to rollback

[2022-03-05 01:31:08] Cleaning stuff up...

[2022-03-05 01:31:08] Removing tmp '/var/www/discourse/tmp/restores/default/2022-03-05-013108' directory...

[2022-03-05 01:31:08] Marking restore as finished...

[2022-03-05 01:31:08] Notifying 'Joaquin' of the end of the restore...

```

What I have gathered so far from my research is that the “schema” that the exception says I should “migrate first!” has something to do with the database that Discourse uses.

I have looked around on Discourse Meta, and have not seen anyone talking about this. I also updated Discourse to the latest version and then tried to restore again, but that had the same result. I poked around in the Discourse files to see if there was a relevant tool that might help, but didn’t see anything that looked promising.

My best guess right now is that during that week after I set up our self-hosted Discourse, something was changed with our trial forum on [trydiscourse.com](http://trydiscourse.com).

My questions are:

1. How can I do the migration that the error suggests?
2. What exactly caused this restore failure? Is this something that would ever happen normally (not during a transition from trial to self-hosted)?

Thanks in advance for any assistance with this! 🙂

---

<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: [23 במרץ,‏ 2022,‏ 6:59pm UTC](https://meta.discourse.org/t/during-restore-exception-youre-trying-to-restore-a-more-recent-version-of-the-schema-you-should-migrate-first/221800/2 "2022-03-23T18:59:47Z")

</div>

You should make sure that you rebuild your self hosted instance with at least the same plugins that have been installed on your trial.

Alternatively, if you feel adventurous, you could rename your backup file, replacing `20220223161000` with `20220220234155` in the file name.

---

<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: [23 במרץ,‏ 2022,‏ 8:22pm UTC](https://meta.discourse.org/t/during-restore-exception-youre-trying-to-restore-a-more-recent-version-of-the-schema-you-should-migrate-first/221800/3 "2022-03-23T20:22:32Z")

</div>

I encountered the same issue a few days ago. The search feature quickly led me to the solution:

> [@Can't restore backup from business 7 to fresh install due to version error](https://meta.discourse.org/t/cant-restore-backup-from-business-7-to-fresh-install-due-to-version-error/214876/2):
>
> Probably just a migration from a plugin that isn’t installed on your system. Replacing the version number in the filename should solve it.

(same as @RGJ by the way).

---

<div class="post-metadata">

### Author: ![Joaquin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joaquin/32/254084_2.png) [@Joaquin](https://meta.discourse.org/u/Joaquin)
#### Post date: [24 במרץ,‏ 2022,‏ 12:10am UTC](https://meta.discourse.org/t/during-restore-exception-youre-trying-to-restore-a-more-recent-version-of-the-schema-you-should-migrate-first/221800/4 "2022-03-24T00:10:58Z")

</div>

Thanks for the replies! That is very helpful ❤

I am still curious about how to do the migration, but it sounds like that may not be needed.
