Unique IDs are not really unique (copy things and lists of things)

Hello Bubblers. Please give me a hand with the following.

If I get it right, Bubble is using thing’s unique ID to describe relationships between the records. So when I put an Apple is in a Basket, the Basket’s field “Apples” contains a unique ID of that apple.

Now, I decided to copy that very same Apple to Basket number 2. The new basket naturally gets a new unique ID, but the copied apple has the same unique ID as the one in Basket number 1. Which is strange to me, because unique ID is not unique then.

This is a big problem, because I get duplicated records. I can filter them through Basket IDs, but it’s not always possible.

How does one come around that?

Databases work like that :upside_down_face::upside_down_face:

But it depends on the use case. If you are worried about changing a product after customer has bought it, you can either hard copy the values you need in your orders “item”, or you can use a versioning system of your inventory.

I prefer the versioning system. Basically, when you create your item you give it a version 0. When you change the price or other attributes, you make a new “apple” and gives this version 1, 2 etc., and also create a link to the first version for tracking.
That way you can change attributes without messing up old order histories.


Thanks a lot for replying… I am not a database person for sure. In my world, word “unique” means “unique”, and two items can’t have same unique id, even though one is copy of another. Anyways…

If I got you right, versioning is what I was thinking about. Juts instead of assigning apples a version, I will assign them a basket.

That’s quite alright. The way I see it is that the apple is a unique item, and even if you link to that apple from your basket, you dont get another apple, therefore there should not be created another id. If you COPY the apple, you will get a new id though.

It’s not clear to me what your usecase is, but versioning do well in product based apps in general.