Skip to content

Migration / versions of data definitions #71

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

Open
Jorgen-P opened this issue Jan 30, 2021 · 2 comments
Open

Migration / versions of data definitions #71

Jorgen-P opened this issue Jan 30, 2021 · 2 comments
Assignees

Comments

@Jorgen-P
Copy link

I can't find any documentation about or example of changing definitions for data and migrating old data to it. Would you create a new class and migrate the data in the application with no direct support from xodus-dnq? Would you have to move everything linked to new definitions as well?

@lehvolk lehvolk self-assigned this Feb 1, 2021
@lehvolk
Copy link
Contributor

lehvolk commented Feb 3, 2021

We recommend to write application code for data migration.

Renaming entity type, property or link

You can use aliases for all properties, links, blobs and entity types. Like var email by xdStringProp(dbName="_email_") or object : XdNaturalEntityType("OldDeprecatedName")

Data structure migration

This is the most problematic case. When you run application with new model definition you should apply new model definition to the database. It's better to do as a separate startup step. Migration code will use only new model definition so cascade operations from old model definition should be applied manually.

We can give some recommendations:

  • use batches for processing large datasets
  • If dataset is very large then probably using low-level api (Store API) of the database can dramatically reduce execution time (keep in mind that constraints and cascade operations defined in DNQ will not be triggered). In YouTrack we use this when we need to update really huge set (>1M of records or more at the moment). Sometimes it gives x30 boost.

I will add this into our documentation somewhere.

@Jorgen-P
Copy link
Author

Thank you for the advice.

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