Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataStore2.Combine by default in 2.0.0 (with settings for existing users) #38

Open
Kampfkarren opened this issue Jul 23, 2019 · 5 comments
Milestone

Comments

@Kampfkarren
Copy link
Owner

This is something that wasn't born until after it was seen to be an issue without, but new developers won't realize how necessary this is and not do it. Perhaps introduce DataStore2.Uncombine for the opposite, or just tell developers that were using DataStore2 before to just disable the settings. Also introduce a setting for a master key.

@visskiss
Copy link

Is there a migration guide somewhere?

@Kampfkarren
Copy link
Owner Author

Not yet, though I should write one before starting work on this.

If you're making a new game/making new data, all you should need to do is write at the top:
DataStore2.Combine("DATA", "yourKeyHere")

So if you were adding coins to your game, at the top (ideally soon after requiring DataStore2), you'd write:
DataStore2.Combine("DATA", "coins")

For existing games, I do want to write a way to transfer uncombined data to combined data stores.

@Kampfkarren
Copy link
Owner Author

Idea for migration: introduce a DataStore2.MigrateUncombined or something in a global configuration that'll add the following overhead to initial :Get calls:

  • When calling :Get() with no data, check the combined data store first
  • If there's no data in the combined data store, call Get on the uncombined data store
  • If the was data in the uncombined data store, mark the data store as needing to save (so when they leave it saves into the combined data store)

This is what users have to do already to migrate their data from an uncombined store to a combined one, so it helps for it to be native. Explicit opt in because we don't want to give this overhead to anyone who already have combined data stores set up correctly.

@Kampfkarren Kampfkarren pinned this issue Sep 13, 2019
@Cabledragon
Copy link

Cabledragon commented Nov 7, 2019

Sorry for posting this here, but I have no other way of contacting you. For some godforsaken reason the roblox devform won't make me a new user even after like a week of browsing the forums and doing everything I can, including emailing support. So I can't post there at all. ):

I digress. Since Combine is not yet automatic, I was wanting to make it automatic for my personal uses so as to not have to call Combine a trillion times. I'm a veteran programmer, but very new to lua and it's quirks and metatables, so my plan is to simply create a wrapper function that calls DataStore2() then DataStore2.Combine() on the key just created, then return DS2() as normal. But I was wondering how I could elegantly check if a "key" exists, so I don't run Combine each time a player joins and a new DS2() is called for that player of the same "key". Any help or solution? Thank you and sorry again for posting this here, you can feel free to remove this.

@Kampfkarren
Copy link
Owner Author

Kampfkarren commented Nov 7, 2019

It's fine to call Combine as much as you want. It doesn't do anything other than say "If you see this key, you're going to be doing it a different way". Not sure what the question is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants