mirror of
https://github.com/clearml/clearml-server
synced 2025-01-31 19:06:55 +00:00
13 lines
392 B
Python
13 lines
392 B
Python
|
from pymongo.collection import Collection
|
||
|
from pymongo.database import Database
|
||
|
|
||
|
|
||
|
def migrate_backend(db: Database):
|
||
|
projects: Collection = db["project"]
|
||
|
for doc in projects.find({"basename": None}):
|
||
|
name: str = doc["name"]
|
||
|
_, _, basename = name.rpartition("/")
|
||
|
projects.update_one(
|
||
|
{"_id": doc["_id"]}, {"$set": {"basename": basename}},
|
||
|
)
|