test(drawdb): add test for converting column types with modifiers
* Implement tests to ensure explicit type modifiers are preserved during conversion. * Validate behavior for varchar, numeric, and custom vector types.
This commit is contained in:
@@ -698,3 +698,23 @@ func TestTypeMapper_BuildBunTag(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestTypeMapper_BuildBunTag_PreservesExplicitTypeModifiers(t *testing.T) {
|
||||
mapper := NewTypeMapper()
|
||||
|
||||
col := &models.Column{
|
||||
Name: "embedding",
|
||||
Type: "vector(1536)",
|
||||
Length: 1536,
|
||||
Precision: 0,
|
||||
Scale: 0,
|
||||
}
|
||||
|
||||
tag := mapper.BuildBunTag(col, nil)
|
||||
if !strings.Contains(tag, "type:vector(1536),") {
|
||||
t.Fatalf("expected explicit modifier to be preserved, got %q", tag)
|
||||
}
|
||||
if strings.Contains(tag, ")(") {
|
||||
t.Fatalf("type modifier appears duplicated in %q", tag)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user