mirror of
https://github.com/clearml/clearml-server
synced 2025-03-03 10:43:10 +00:00
Add v1.6.0 mongodb migration
This commit is contained in:
parent
fe29743c54
commit
3f79c19079
12
apiserver/mongo/migrations/1_6_0.py
Normal file
12
apiserver/mongo/migrations/1_6_0.py
Normal file
@ -0,0 +1,12 @@
|
||||
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}},
|
||||
)
|
Loading…
Reference in New Issue
Block a user