D
D
danforth2017-11-16 04:45:42
Database design
danforth, 2017-11-16 04:45:42

How to ensure data integrity?

The question is about designing your blog or CMS:
Let's say we have an average blog that has posts and attachments (pictures). We create a post, and inside, through the WYSIWYG editor, we insert a picture (it is saved to disk).
After some time, the post becomes irrelevant, unnecessary, and we delete it. Or, for example, the picture becomes irrelevant, and we delete only the picture, and instead we load a new one. The image itself remains on disk. This is unnecessary data that is not used anywhere else. Over time, a project can acquire a large amount of such data. This will also affect backups, which will store some of the pictures that are ballast.
The questions are:

  1. How is it implemented in modern CMS? When deleting a post/image from a post, do the image files remain on disk?
  2. How to find attachments that are not used anywhere?
  3. What is the most correct approach in this case?

PS It seems to me that you should not worry about the remaining data, the disk space is not so expensive now, but from the point of view of rationality, I would like to be able to find such data and, if necessary, clean it up without breaking anything.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-11-16
@Stalker_RED

1. What prevents you from deleting pictures that are no longer used?
2. We go through the folders with pictures, check if there are links to them in the database.
3. The most correct may vary depending on the conditions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question