added support for specifying collection id with the factory and added collections indexes validator to prevent duplicated definitions

This commit is contained in:
Gani Georgiev
2024-11-03 10:44:48 +02:00
parent c3557d4e94
commit 106ce0f0c4
7 changed files with 119 additions and 67 deletions

View File

@@ -434,6 +434,18 @@ func TestCollectionValidate(t *testing.T) {
},
expectedErrors: []string{"indexes"},
},
{
name: "duplicated index definitions",
collection: func(app core.App) (*core.Collection, error) {
c, _ := app.FindCollectionByNameOrId("demo1")
c.Indexes = []string{
"create index idx_test_demo1 on demo1 (id)",
"create index idx_test_demo2 on demo1 (id)",
}
return c, nil
},
expectedErrors: []string{"indexes"},
},
{
name: "try to add index to a view collection",
collection: func(app core.App) (*core.Collection, error) {