5

I backuped my website with Backup and Migrate. I made some tests and restored a few times successfully.

Then I created some fields (one of them is named field_date), and made some tests; I was not satisfied so I restored again.

Then I wanted to create a field named field_date, which should not be in the database after restore to previous state, but I got the following error message:

DatabaseSchemaObjectExistsException: Table field_data_field_date already exists in DatabaseSchema->createTable() (line 630 of /var/www/includes/database/schema.inc).

How is this possible? None of my backups works to turn the site to the initial state. Is this bug in the module I used for the backup, or is this feature and I should use more reliable backup utility?

1 Answer 1

8

When restoring, you first need to drop your old database (or all tables within). The restore can only replace the tables that existed when you created the export, it doesn't know about any tables that you created later on.

8
  • 1
    I go into phpmyadmin and drop all the tables. Then I import by searching the last saved database in the sites/default/notpublic/backup folder. Easy peasy.
    – Adam S
    Commented May 9, 2011 at 16:40
  • Thank you. I used the command in mysql drop database drupaldb. Reinstalled Drupal and restored. There isn't faster procedure or should I always drop database, reinstall Drupal and restore?
    – xralf
    Commented May 9, 2011 at 16:45
  • You could open a feature request for backup_migrate to do something like this. Or maybe there is one already, so have a look at the issue queue.
    – Berdir
    Commented May 9, 2011 at 16:47
  • Maybe it would help to delete only the table field_data_field_date, but I haven't try this.
    – xralf
    Commented May 9, 2011 at 17:05
  • 1
    @xralf: You can't just delete a specific table, because you don't know which tables where created since you're last backup. And trying to figure that out would be much slower than just re-creating the database with two quick cli commands. And automating it would be complicted too because you can for example let backup_migrate ignore certain tables and so on.
    – Berdir
    Commented May 9, 2011 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.