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
Data migration after removing obsolete data classes #875
Comments
We could make the upgrade command check whether the obsolete tables contain any data. If they do contain data, we warn the user about the potential loss of data and offer to automatically create a dump file. If they don't contain data, we can drop the obsolete tables. |
Yes to the check, no to the automatic dump file creation. |
First step: Run |
The correct command is Models previously used for devices
Models previously used for markets
Models previously used for weather sensors
Linked indicesFYI, the following indices are linked to sensor ids (i.e. pointing to a db model currently in use):
In theory, these could be used to check (perhaps through a checksum of sorts) whether old data had already been copied from the |
After removing obsolete dataclasses in PR #695 the data migration needs to be done.
db migrate
creates a large file that is not able to execute because of the data relationships and needs to be manually checked."The data migration is still a sizable task. Running
flexmeasures db migrate
generates a very large auto revision file (~200 lines) that needs to be checked manually. These predominantly deal with the downgrade.There is also the offchance that the deleted tables contain user data that has not been migrated yet. This should only be possible in case data was added by circumventing our own classes (e.g. initializing an Asset has been leading to initialize a GenericAsset and a Sensor under the hood). However, I can't guarantee that simply removing the old tables wouldn't lead to some loss of data. Therefore, I suggest creating backups of the deleted tables.
Foreseeing this exact discussion, I had moved the database migration into the list of follow-up tasks to this PR (see task list above)."
Originally posted by @Flix6x in #695 (comment)
The text was updated successfully, but these errors were encountered: