Hi all, Pictures are stored into...: changed to File under Media Settings (I have nopcommerce 2.7) But I did this after a month of development and all previous pics are still in DB That table is 4 GB still, even though my setting in now set to store in File system. How can I now reduce the size of the Picture table? Do you guys have a script? I assume any new pics get uploaded go to file system, correct? What about the data that was there before I changed setting? Please help Thanks James
ty but that did not work. The issue is I uploaded 10,000+ products with images. Now after categorizing, I am only using 2000+ products/images. So that means I don't need 8000 images in that Picture table DBCC shrinkfile wont' help Perhaps a query to tell me which images are not being used anywhere would help so I can delete those by script? But i need to know what that script is?
SELECT p.Id FROM Picture p LEFT JOIN Product_Picture_Mapping ppm ON ppm.PictureId = p.Id LEFT JOIN ProductVariant pv ON pv.PictureId = p.Id LEFT JOIN Category c ON c.PictureId = p.Id WHERE ppm.Id IS NULL AND pv.Id IS NULL AND c.Id IS NULL
This should give you the rows in Picture that are not associated to anything else and should be safe to delete. If there is another table that uses Picture that I didn't include, you'll delete it's pictures so make sure you back up your database first.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.