Skip to content

Commit 355d79b

Browse files
sm745052Sandeep Mishra
andauthored
added Numeric as an option as target datatype for bigint (GoogleCloudPlatform#1187)
Co-authored-by: Sandeep Mishra <iamsandeep@google.com>
1 parent 1019e94 commit 355d79b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

sources/mysql/toddl.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ func toSpannerTypeInternal(srcType schema.Type, spType string) (ddl.Type, []inte
137137
switch spType {
138138
case ddl.String:
139139
return ddl.Type{Name: ddl.String, Len: ddl.MaxLength}, []internal.SchemaIssue{internal.Widened}
140+
case ddl.Numeric:
141+
return ddl.Type{Name: ddl.Numeric}, []internal.SchemaIssue{internal.Widened}
140142
default:
141143
return ddl.Type{Name: ddl.Int64}, nil
142144
}

sources/mysql/toddl_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ func TestToSpannerTypeInternal(t *testing.T) {
6767
if errCheck == nil {
6868
t.Errorf("Error in bigint to string conversion")
6969
}
70+
_, errCheck = toSpannerTypeInternal(schema.Type{"bigint", []int64{1, 2, 3}, []int64{1, 2, 3}}, "NUMERIC")
71+
if errCheck == nil {
72+
t.Errorf("Error in bigint to numeric conversion")
73+
}
7074
_, errCheck = toSpannerTypeInternal(schema.Type{"int", []int64{1, 2, 3}, []int64{1, 2, 3}}, "STRING")
7175
if errCheck == nil {
7276
t.Errorf("Error in int to string conversion")

0 commit comments

Comments
 (0)