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

How to migrate data #222

Open
gempir opened this issue Apr 16, 2024 · 2 comments
Open

How to migrate data #222

gempir opened this issue Apr 16, 2024 · 2 comments

Comments

@gempir
Copy link

gempir commented Apr 16, 2024

I followed the example tldraw App https://github.com/drifting-in-space/y-sweet/blob/main/examples/nextjs/src/app/tldraw/useYjsStore.ts#L24

The issue is tldraw changed their document structure a bit tldraw/tldraw#3463

loadSnapshot should take care of this issue.

But loadSnapshot is only called to initialize the empty document it looks like.

I don't quite follow how y-sweet loads everything that is already on the server and needs to be initially loaded.

How would I achieve a migration on this data?

@paulgb
Copy link
Member

paulgb commented Apr 16, 2024

Hi, this is something we have been thinking about but don't yet have a good answer on to be honest. It's part of a broader issue of data migration with CRDTs.

Do you have ideas on how you would like to see it work? One idea I've had is to allow you to provide a script to the server that runs every time the data is loaded from storage, which would give you a place to do any migration tasks, which would then be synchronized down to clients when they connect.

@gempir
Copy link
Author

gempir commented Apr 17, 2024

I think generally that idea is good.

The responsibility of removing the script from the sever when migration is no longer required then lies on the user.

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

No branches or pull requests

2 participants