0

I usually take backup of the entire database before importing new configurations, but this time I didn't and now I need to double check something with old version of database. Is it possible to just revert the changes done by drush cim?

I am using Drupal 8.

Googling for this specific situation didn't give me any solution.

2
  • 3
    Configuration is saved in yml files inside the /config folder and not the database. If you use a version control system like GIT, you could see and also revert changes.
    – No Sssweat
    Sep 15, 2021 at 6:42
  • 1
    You might still need a database backup, reverting config doesn't restore deleted content.
    – 4uk4
    Sep 15, 2021 at 12:21

1 Answer 1

0

No, you can't revert drush cim without a backup (or alternate config export) of some sort. If you don't have a backup, you're out of luck.

One safety measure to prevent this kind of problem is to write a script that backs up your database and then calls drush cim. Then, only run the script to do a config import, and you can ensure you have always made a backup first.

4
  • :( Thanks anyway! Sep 15, 2021 at 5:37
  • 6
    Another safety measure is to use version control ;+)
    – No Sssweat
    Sep 15, 2021 at 6:43
  • @NoSssweat version control does not help at all since changes can originate from the UI, which are then overwritten by drush cim. Only safe way is to backup the config tables, or drush cex to export current state, store it (either in version control or as a zip) and then run drush cim. Oct 6 at 8:40
  • No Sssweat is correct. He meant to do what most developers do for deployments which is to run drush cex to export your config.. and then, user version control to commit this config. So when you run cim and its not what you wanted; you can simply revert to an older version of your config; and cim that one.
    – liquidcms
    Oct 28 at 19:59

Your Answer

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

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