
Description
@Toutouwai commented on Apr 10, 2019, 3:32 AM UTC:
Short description of the issue
If I make a database backup using WireDatabaseBackup::backup()
at time 1, and then later restore that backup at time 2 using WireDatabaseBackup::restore()
, I expected the database to be put into the same state as at time 1.
But if there is some new table at time 2 that didn't exist when the backup was made at time 1 then that table is not dropped and persists in the database after the restore. One way this is a problem is with field tables. If a new field "foo" was created between time 1 and time 2 then restoring the backup removes the field from the PW admin (expected) but the "field_foo" table persists (unexpected) which creates a database error when attempting to create a field with that name.
I noticed the problem using ProcessDatabaseBackups but the issue occurs also with the core WireDatabaseBackup::backup()
/ WireDatabaseBackup::restore()
methods.
Field tables at time of backup:
New field "cost" is created.
Field tables after backup is restored:
Setup/Environment
- ProcessWire version: 3.0.129
This issue was moved by ryancramerdesign from processwire/processwire-issues#846.