mirror of
https://github.com/clearml/clearml-server
synced 2025-01-31 10:56:48 +00:00
23 lines
785 B
Python
23 lines
785 B
Python
from pymongo.collection import Collection
|
|
from pymongo.database import Database
|
|
|
|
|
|
def _migrate_project_description(db: Database):
|
|
projects: Collection = db["project"]
|
|
filter = {
|
|
"$or": [
|
|
{
|
|
"$expr": {"$lt": [{"$strLenCP": "$description"}, 100]},
|
|
"description": {"$regex": "^Auto-generated at ", "$options": "i"},
|
|
},
|
|
{"description": {"$regex": "^Auto-generated during move$", "$options": "i"}},
|
|
{"description": {"$regex": "^Auto-generated while cloning$", "$options": "i"}},
|
|
]
|
|
}
|
|
for doc in projects.find(filter=filter):
|
|
projects.update_one({"_id": doc["_id"]}, {"$unset": {"description": 1}})
|
|
|
|
|
|
def migrate_backend(db: Database):
|
|
_migrate_project_description(db)
|