From a772fe23b86f8f2d35a0ec725f138f48ef0e8a2a Mon Sep 17 00:00:00 2001 From: Ildar Nurislamov Date: Tue, 19 Nov 2024 17:35:34 +0400 Subject: [PATCH] bulker: respect type of existing "_unmapped_data" column --- bulkerlib/implementations/sql/abstract.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bulkerlib/implementations/sql/abstract.go b/bulkerlib/implementations/sql/abstract.go index 32cde18..b34cb39 100644 --- a/bulkerlib/implementations/sql/abstract.go +++ b/bulkerlib/implementations/sql/abstract.go @@ -258,9 +258,10 @@ func (ps *AbstractSQLStream) adjustTableColumnTypes(currentTable, existingTable, } } if len(unmappedObj) > 0 { + var existingCol types.SQLColumn ok := false if existingTable.Exists() { - _, ok = existingTable.Columns.Get(ps.unmappedDataColumn) + existingCol, ok = existingTable.Columns.Get(ps.unmappedDataColumn) } if !ok { jsonSQLType, _ := ps.sqlAdapter.GetSQLType(types.JSON) @@ -268,6 +269,8 @@ func (ps *AbstractSQLStream) adjustTableColumnTypes(currentTable, existingTable, if added { columnsAdded++ } + } else { + current.Set(ps.unmappedDataColumn, existingCol) } if ps.sqlAdapter.StringifyObjects() { b, _ := jsoniter.Marshal(unmappedObj)