mirror of
https://github.com/clearml/clearml-server
synced 2025-03-03 18:54:20 +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):
|
def migrate_auth(db: Database):
|
||||||
collection: Collection = db["user"]
|
collection: Collection = db["user"]
|
||||||
if "name_1_company_1" in [doc["name"] for doc in collection.list_indexes()]:
|
collection.drop_indexes()
|
||||||
collection.drop_index("name_1_company_1")
|
|
||||||
|
|
||||||
|
|
||||||
def migrate_backend(db: Database):
|
def migrate_backend(db: Database):
|
||||||
|
@ -31,8 +31,8 @@ def migrate_auth(db: Database):
|
|||||||
if not uuids:
|
if not uuids:
|
||||||
return
|
return
|
||||||
|
|
||||||
collection = db["user"]
|
collection: Collection = db["user"]
|
||||||
collection.drop_index("name_1_company_1")
|
collection.drop_indexes()
|
||||||
|
|
||||||
_switch_uuid(collection=collection, uuid_field="_id", uuids=uuids)
|
_switch_uuid(collection=collection, uuid_field="_id", uuids=uuids)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user