You are here: Re: [PHP] Best practices for deleting and restoring records - moving vs flagging « PHP « IT news, forums, messages
Re: [PHP] Best practices for deleting and restoring records - moving vs flagging

Posted by Jochem Maas on 08/12/05 20:44

Saqib Ali wrote:
> Hello All,
>
> What are best practices for deleting records in a DB. We need the
> ability to restore the records.
>
> Two obvious choices are:
>
> 1) Flag them deleted or undeleted
> 2) Move the deleted records to seperate table for deleted records.
>
> We have a complex schema. However the the records that need to be
> deleted and restored reside in 2 different tables (Table1 and Table2).
>
> Table2 uses the primary key of the Table1 as the Foriegn key. The
> Primary key for Table1 is auto-generated. This make the restoring with
> the same primary key impossible, if we move deleted data to a

why is restoring auto-generated keys impossible? do you have that many records
that the auto-gen rolls over? also if it is auto-generated then technically
I don't see a reason that generating a new id upon re-insertion would
be problematic - the id is just an arbitrary unique identifier - as long
as you keep the link between reinserted records in table1 en table2
(given the id maybe used else where!).

sounds like flagging it easier regardless of what is better performance-wise.

> different table. However if we just flag the record as deleted the
> restoring is quite easy.
>
> Any thoughts/ideas ?
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация