# SQL Error during import

**URL:** <https://meta.discourse.org/t/sql-error-during-import/27793>\
**Category:** Self-hosting\
**Created:** [April 21, 2015, 9:06am UTC](https://meta.discourse.org/t/sql-error-during-import/27793 "2015-04-21T09:06:16Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Bahlsen](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@Bahlsen](https://meta.discourse.org/u/Bahlsen)\
**Post date:** [May 3, 2015, 12:24pm UTC](https://meta.discourse.org/t/sql-error-during-import/27793/5 "2015-05-03T12:24:01Z")

</div>

I am the one with the problem. When editing the file, I get this.

Trying to delete the line, I get this error when running the restore. The restore fails fairly quickly, right after starting to unzip, and before any text dump

```
[2015-05-03 11:10:16] Marking restore as running...
[2015-05-03 11:10:16] Making sure /var/www/discourse/tmp/restores/default/2015-05-03-111015 exists...
[2015-05-03 11:10:16] Copying archive to tmp directory...
[2015-05-03 11:11:15] Unzipping archive...
[2015-05-03 11:13:05] Extracting metadata file...
[2015-05-03 11:13:07] Validating metadata...
[2015-05-03 11:13:07] Current version: 20150422160235
[2015-05-03 11:13:08] EXCEPTION: undefined method `[]' for nil:NilClass
[2015-05-03 11:13:08] /var/www/discourse/lib/backup_restore/restorer.rb:176:in `validate_metadata'
/var/www/discourse/lib/backup_restore/restorer.rb:35:in `run'
/var/www/discourse/lib/backup_restore/backup_restore.rb:161:in `block in start!'
/var/www/discourse/lib/backup_restore/backup_restore.rb:158:in `fork'
/var/www/discourse/lib/backup_restore/backup_restore.rb:158:in `start!'
/var/www/discourse/lib/backup_restore/backup_restore.rb:17:in `restore!'
/var/www/discourse/app/controllers/admin/backups_controller.rb:74:in `restore'

```

I do the following.

1. I have renamed the backup to “`original-cocos2d-forum-2015-05-01-041307.tar.gz`”
2. I then create a new folder: “`mkdir cocos2d-forum-2015-05-01-041307`”
3. I unzip the original backup: “`tar -xvzf original-cocos2d-forum-2015-05-01-041307.tar.gz -C cocos2d-forum-2015-05-01-041307`”
4. I switch to the folder, and fire up nano: “`nano dump.sql`”
5. I goto the line by using Ctrl+\_ and enter line 3864981. I edit the line from: “`CREATE UNIQUE INDEX post_timings_unique ON post_timings USING btree (topic_id, post_number, user_id);`” to “`-- CREATE UNIQUE INDEX post_timings_unique ON post_timings USING btree (topic_id, post_number, user_id);`”
6. I Ctrl+O and Ctrl+X out of nano
7. I switch back to backups/default folder, and create a tar.gz: “`tar -cvzf cocos2d-forum-2015-05-01-041307.tar.gz cocos2d-forum-2015-05-01-041307`”

In FileZilla, it then looks like this

 ![](https://global.discourse-cdn.com/meta/original/3X/5/d/5d12ef0f205201cc6550a36827880f550faf18b2.png) 

I really hope you can help me.

Cheers  
Lars

---

_[View the full topic](https://meta.discourse.org/t/sql-error-during-import/27793)._
