mirror of
https://github.com/clearml/clearml-server
synced 2025-03-03 02:33:02 +00:00
Fix dropping index by name during the migration fails if the index does not exist
This commit is contained in:
parent
d029d56508
commit
7a4a5eb03e
@ -5,8 +5,7 @@ from pymongo.database import Database, Collection
|
||||
|
||||
def migrate_auth(db: Database):
|
||||
collection: Collection = db["user"]
|
||||
if "name_1_company_1" in [doc["name"] for doc in collection.list_indexes()]:
|
||||
collection.drop_index("name_1_company_1")
|
||||
collection.drop_indexes()
|
||||
|
||||
|
||||
def migrate_backend(db: Database):
|
||||
|
@ -31,8 +31,8 @@ def migrate_auth(db: Database):
|
||||
if not uuids:
|
||||
return
|
||||
|
||||
collection = db["user"]
|
||||
collection.drop_index("name_1_company_1")
|
||||
collection: Collection = db["user"]
|
||||
collection.drop_indexes()
|
||||
|
||||
_switch_uuid(collection=collection, uuid_field="_id", uuids=uuids)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user