diff --git a/index_v3.go b/index_v3.go index b3012f0..c60fa9d 100644 --- a/index_v3.go +++ b/index_v3.go @@ -160,7 +160,7 @@ func createAllIndexesAndConstraintsV3(ctx context.Context, gogm *Gogm, mappedTyp Name: node, Type: structConfig.Label, Field: config.Name, - })).ToCypher() + })).Cypher("IF NOT EXISTS").ToCypher() if err != nil { return err } @@ -180,7 +180,7 @@ func createAllIndexesAndConstraintsV3(ctx context.Context, gogm *Gogm, mappedTyp cyp, err := dsl.QB().Create(dsl.NewIndex(&dsl.IndexConfig{ Type: structConfig.Label, Fields: indexFields, - })).ToCypher() + })).Cypher("IF NOT EXISTS").ToCypher() if err != nil { return err }