mercredi 13 mars 2019

Cleaning up data in a table?

Here is a simplified version of what is happening:

  1. The user completes a form.

  2. When storing the form, the row id is stored in the session.

  3. The user then logs in.

  4. The event of a user logging in is caught and the correct row (id taken from session) is then updated with the users id.

Now if the user only completes step 1 and step 2 then abandons the process because they do not want to log in (not my idea of laying this out btw) the database is left with rows of data not attributed to a user.

I need to remove these rows.

What would be the best way to achieve this?

  1. Is there a way to do a database transaction that runs across requests, so it can be started before login and committed after log in?

  2. Would a cleanup script running every so often be best, finding no user attributed rows and deleting them?

Or is there another way?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire