This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import src.repository.user_repository as user_repository | ||
|
||
|
||
def migrate_notifications(): | ||
""" | ||
The data structure for metrics and notifications has changed. | ||
This function migrates the data to the new structure by simply deleting the old user data structure | ||
and replacing it with the new one. Every user was simply using the defaults anyhow, so no data is lost. | ||
:return: | ||
""" | ||
for user in user_repository.user.find(): | ||
user_repository.user.delete_one({"user_id": user["user_id"]}) | ||
user_repository.create_user(user["user_id"]) | ||
|
||
|
||
if __name__ == "__main__": | ||
migrate_notifications() |