Skip to content

Commit a4cdbe2

Browse files
committed
Fixes issue #116
1 parent 6435310 commit a4cdbe2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

oracle/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ func getBulkReturningValues(db *gorm.DB, rowCount int) {
960960
}
961961

962962
// Get all table columns
963-
allColumns := db.Statement.Schema.DBNames
963+
allColumns := getCreatableFields(db.Statement.Schema)
964964

965965
// Find the actual starting index of OUT parameters
966966
actualStartIndex := -1

tests/create_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,18 +1004,22 @@ func TestCreateChildrenWithMixedPointers(t *testing.T) {
10041004

10051005
}
10061006

1007+
// Fixes Issue #116
10071008
func TestCreateReadOnlyJson(t *testing.T) {
10081009
type record struct {
1009-
ID string `gorm:"column:child_id;primaryKey;type:varchar(36)"`
1010-
ReadOnlyField string `gorm:"->;-:migration;column:read_only_field;type:varchar(100)"`
1011-
JsonTypeField datatypes.JSON `gorm:"column:json_type_field;type:json"`
1010+
ID string `gorm:"column:child_id;primaryKey;type:varchar(36)"`
1011+
ReadOnlyField string `gorm:"->;-:migration;column:read_only_field;type:varchar(100)"`
1012+
JsonTypeField datatypes.JSON `gorm:"column:json_type_field;type:json"`
1013+
JsonTypeField2 AttributeMap `gorm:"column:json_type_field2;type:json"`
10121014
}
10131015

10141016
json := datatypes.JSON(fmt.Sprintf(`{"key":"%s"}`, strings.Repeat("x", 4000)))
1017+
attributeMapJSON := AttributeMap{"key": strings.Repeat("x", 4000)}
10151018
records := []record{
10161019
{
1017-
ID: "1",
1018-
JsonTypeField: json,
1020+
ID: "1",
1021+
JsonTypeField: json,
1022+
JsonTypeField2: attributeMapJSON,
10191023
},
10201024
{
10211025
ID: "2",

0 commit comments

Comments
 (0)