test deleteMissing with schema changes
This commit is contained in:
+10
-1
@@ -190,7 +190,7 @@ func (dao *Dao) ImportCollections(
|
||||
|
||||
mappedImported := make(map[string]*models.Collection, len(importedCollections))
|
||||
for _, imported := range importedCollections {
|
||||
// normalize
|
||||
// normalize ids
|
||||
if !imported.HasId() {
|
||||
// generate id if not set
|
||||
imported.MarkAsNew()
|
||||
@@ -199,6 +199,15 @@ func (dao *Dao) ImportCollections(
|
||||
imported.MarkAsNew()
|
||||
}
|
||||
|
||||
// extend existing schema
|
||||
if existing, ok := mappedExisting[imported.GetId()]; ok && !deleteMissing {
|
||||
schema, _ := existing.Schema.Clone()
|
||||
for _, f := range imported.Schema.Fields() {
|
||||
schema.AddField(f) // add or replace
|
||||
}
|
||||
imported.Schema = *schema
|
||||
}
|
||||
|
||||
mappedImported[imported.GetId()] = imported
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user