Restoring Newer Records To An Older Version Of Database

Admin-ing a multi-vendor system, and found vendors will still adding products to a category no longer in use, even though it was hidden. So from the categories set-up page, we deleted the category.



Little did we know this will also delete the underlying products! Even products that belong to other categories. Gone, and their product shots too.



We didn’t catch it for a few hours, so in the meantime we had other new records added to the database and file system.



Now we’re restoring from our last backup, and trying to figure out how to restore the additions made since the category deletion.



Is there a process for restoring new records to an older version of the database? Doing a diff on the tables is not straightforward because of the way the database repurposes deleted records.



CS-Cart definitely needs to add some kind of warning dialog to the delete categories command!

It should only delete the product if that is the last reference to that product_id from ANY category.

I think you wanted 'Disabled' rather than 'Hidden' for your defunct categories.

[quote name='tbirnseth' timestamp='1399149843' post='182857']

It should only delete the product if that is the last reference to that product_id from ANY category.

I think you wanted 'Disabled' rather than 'Hidden' for your defunct categories.

[/quote]



Possibly the hidden category was defined as main for the products and active categories were defined as additional.

I believe a product will not be deleted unless it is the last reference of all categories regardless of their status.

[quote name='tbirnseth' timestamp='1399321174' post='182955']

I believe a product will not be deleted unless it is the last reference of all categories regardless of their status.

[/quote]



Please check the fn_delete_category function. It does not take into account if product belongs to additional category.

That's a new way of doing things. From what I read, if the product has the deleted category as the main category then it will delete the product. To me, that's a bug. In older versions it was by last reference and I think that's how it should be.

[quote name='tbirnseth' timestamp='1399399899' post='183026']

That's a new way of doing things. From what I read, if the product has the deleted category as the main category then it will delete the product. To me, that's a bug. In older versions it was by last reference and I think that's how it should be.

[/quote]



Checked in 2.0.x, 2.1.x, 2.2.x and 3.0x - the same behavior. Anyway, we are totally agree with you - that's a bug.