How do you deal with data structures changing in datastores?
For example, imagine I have the following:
session = {
health = 100,
experience = 1999,
Inventory = {
Glove = 1,
Bat = 2,
}
}
after a big update on the Test Place, I now have the following:
session = {
health = 100,
experience = 1999,
rating = 5, -- NEW
Inventory = {
glove = 1,
bat = 2,
},
Rewards = { -NEW
streak = true, -- NEW
record = false, -- NEW
}
}
I have added session.rating
, session.Rewards.Streak
and session.Rewards.Record
.
How can I update ALL the existing players so they now have this new data structure?
I’m aware there are different ways of doing this, I’m curious to see what is suggested.
One way I would not like to do it, is by adding an IF-ELSE to check if Player already has this structure and then add it. I’m hoping for a more sophisticated way (scalable) of doing it.
Appreciate your feedback!