[openstack-dev] [oslo.db] Proposal: Get rid of deleted column

Chris Behrens cbehrens at codestud.com
Tue Aug 20 20:11:08 UTC 2013


On Aug 20, 2013, at 12:51 PM, Ed Leafe <ed at openstack.org> wrote:

> On Aug 20, 2013, at 2:33 PM, Chris Behrens <cbehrens at codestud.com>
> wrote:
> 
>> For instances table, we want to make sure 'uuid' is unique.  But we can't put a unique constraint on that alone.  If that instance gets deleted.. we should be able to create another entry with the same uuid without a problem.  So we need a unique constraint on uuid+deleted.  But if 'deleted' is only 0 or 1… we can only have 1 entry deleted and 1 entry not deleted.  Using deleted=`id` to mark deletion solves that problem.  You could use deleted_at… but 2 creates and deletes within the same second would not work. :)
> 
> This creates another problem if you ever need to delete this second instance, because now you have two with the same uuid and the same deleted status.

Not with the setting of 'deleted' to the row's `id` on delete… since `id` is unique.

- Chris






More information about the OpenStack-dev mailing list