Skip to content

Commit 6779fcc

Browse files
Duplicated col not allowed and datetimewithzone added (#1527)
1 parent e1362a2 commit 6779fcc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

gateway/modules/schema/helpers/helpers.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,9 @@ func getCollectionSchema(doc *ast.Document, dbName, collectionName string) (mode
525525
fieldTypeStuct.TypeIDSize = model.DefaultCharacterSize
526526
}
527527
}
528-
528+
if _, ok := fieldMap[field.Name.Value]; ok {
529+
return nil, helpers.Logger.LogError(helpers.GetRequestID(context.TODO()), fmt.Sprintf("Column (%s) already exists in the Collection/Table(%s). Duplicate column not allowed", field.Name.Value, collectionName), nil, nil)
530+
}
529531
fieldMap[field.Name.Value] = &fieldTypeStuct
530532
}
531533
}

gateway/modules/schema/inspection.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func generateInspection(dbType, col string, fields []model.InspectorFieldType, i
108108

109109
// add string between quotes
110110
switch fieldDetails.Kind {
111-
case model.TypeString, model.TypeVarChar, model.TypeChar, model.TypeID, model.TypeDateTime, model.TypeDate, model.TypeTime:
111+
case model.TypeString, model.TypeVarChar, model.TypeChar, model.TypeID, model.TypeDateTime, model.TypeDate, model.TypeTime, model.TypeDateTimeWithZone:
112112
field.FieldDefault = fmt.Sprintf("\"%s\"", field.FieldDefault)
113113
case model.TypeJSON:
114114
data, err := json.Marshal(field.FieldDefault)

0 commit comments

Comments
 (0)