Repository: ariga/atlas
Pull request #259 (2021-11-28 13:34:20)

sql/sqlspec: Column.TypeName => Column.Type


Patch:
diff --git a/sql/internal/specutil/spec.go b/sql/internal/specutil/spec.go
index 717c0ec9..77a6b002 100644
--- a/sql/internal/specutil/spec.go
+++ b/sql/internal/specutil/spec.go
@@ -8,8 +8,8 @@ import (
 // NewCol is a helper method for constructing *sqlspec.Column instances.
 func NewCol(name, coltype string, attrs ...*schemaspec.Attr) *sqlspec.Column {
 	return &sqlspec.Column{
-		Name:     name,
-		TypeName: coltype,
+		Name: name,
+		Type: coltype,
 		DefaultExtension: schemaspec.DefaultExtension{
 			Extra: schemaspec.Resource{Attrs: attrs},
 		},
diff --git a/sql/mysql/sqlspec.go b/sql/mysql/sqlspec.go
index 2f1107cb..40aee6ca 100644
--- a/sql/mysql/sqlspec.go
+++ b/sql/mysql/sqlspec.go
@@ -81,7 +81,7 @@ func convertColumn(spec *sqlspec.Column, _ *schema.Table) (*schema.Column, error
 
 // convertColumnType converts a sqlspec.Column into a concrete MySQL schema.Type.
 func convertColumnType(spec *sqlspec.Column) (schema.Type, error) {
-	switch sqlspec.Type(spec.TypeName) {
+	switch sqlspec.Type(spec.Type) {
 	case sqlspec.TypeInt, sqlspec.TypeInt8, sqlspec.TypeInt16,
 		sqlspec.TypeInt64, sqlspec.TypeUint, sqlspec.TypeUint8,
 		sqlspec.TypeUint16, sqlspec.TypeUint64:
@@ -101,14 +101,14 @@ func convertColumnType(spec *sqlspec.Column) (schema.Type, error) {
 	case sqlspec.TypeTime:
 		return convertTime(spec)
 	}
-	return parseRawType(spec.TypeName)
+	return parseRawType(spec.Type)
 }
 
 func convertInteger(spec *sqlspec.Column) (schema.Type, error) {
 	typ := &schema.IntegerType{
-		Unsigned: strings.HasPrefix(spec.TypeName, "u"),
+		Unsigned: strings.HasPrefix(spec.Type, "u"),
 	}
-	switch spec.TypeName {
+	switch spec.Type {
 	case "int8", "uint8":
 		typ.T = tTinyInt
 	case "int16", "uint16":
@@ -118,7 +118,7 @@ func convertInteger(spec *sqlspec.Column) (schema.Type, error) {
 	case "int64", "uint64":
 		typ.T = tBigInt
 	default:
-		return nil, fmt.Errorf("mysql: unknown integer column type %q", spec.TypeName)
+		return nil, fmt.Errorf("mysql: unknown integer column type %q", spec.Type)
 	}
 	return typ, nil
 }
@@ -251,9 +251,9 @@ func columnSpec(col *schema.Column) (*sqlspec.Column, error) {
 		return nil, err
 	}
 	return &sqlspec.Column{
-		Name:     col.Name,
-		TypeName: ct.TypeName,
-		Null:     ct.Null,
+		Name: col.Name,
+		Type: ct.Type,
+		Null: ct.Null,
 		DefaultExtension: schemaspec.DefaultExtension{
 			Extra: schemaspec.Resource{Attrs: ct.DefaultExtension.Extra.Attrs},
 		},
@@ -276,18 +276,18 @@ func columnTypeSpec(t schema.Type) (*sqlspec.Column, error) {
 	case *schema.BinaryType:
 		return binarySpec(t)
 	case *schema.BoolType:
-		return &sqlspec.Column{TypeName: "boolean"}, nil
+		return &sqlspec.Column{Type: "boolean"}, nil
 	case *schema.FloatType:
 		precision := specutil.LitAttr("precision", strconv.Itoa(t.Precision))
 		return specutil.NewCol("", "float", precision), nil
 	case *schema.TimeType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.JSONType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.SpatialType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.UnsupportedType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	default:
 		return nil, fmt.Errorf("mysql: failed to convert column type %T to spec", t)
 	}
@@ -296,7 +296,7 @@ func columnTypeSpec(t schema.Type) (*sqlspec.Column, error) {
 func binarySpec(t *schema.BinaryType) (*sqlspec.Column, error) {
 	switch t.T {
 	case tBlob:
-		return &sqlspec.Column{TypeName: "binary"}, nil
+		return &sqlspec.Column{Type: "binary"}, nil
 	case tTinyBlob, tMediumBlob, tLongBlob:
 		size := specutil.LitAttr("size", strconv.Itoa(t.Size))
 		return specutil.NewCol("", "binary", size), nil
@@ -319,18 +319,18 @@ func integerSpec(t *schema.IntegerType) (*sqlspec.Column, error) {
 		if t.Unsigned {
 			return specutil.NewCol("", "uint"), nil
 		}
-		return &sqlspec.Column{TypeName: "int"}, nil
+		return &sqlspec.Column{Type: "int"}, nil
 	case tTinyInt:
-		return &sqlspec.Column{TypeName: "int8"}, nil
+		return &sqlspec.Column{Type: "int8"}, nil
 	case tMediumInt:
-		return &sqlspec.Column{TypeName: tMediumInt}, nil
+		return &sqlspec.Column{Type: tMediumInt}, nil
 	case tSmallInt:
-		return &sqlspec.Column{TypeName: tSmallInt}, nil
+		return &sqlspec.Column{Type: tSmallInt}, nil
 	case tBigInt:
 		if t.Unsigned {
 			return specutil.NewCol("", "uint64"), nil
 		}
-		return &sqlspec.Column{TypeName: "int64"}, nil
+		return &sqlspec.Column{Type: "int64"}, nil
 	}
 	return nil, fmt.Errorf("mysql: schema integer failed to convert %q", t.T)
 }
diff --git a/sql/postgres/sqlspec.go b/sql/postgres/sqlspec.go
index 89c6ef10..ee3ccc30 100644
--- a/sql/postgres/sqlspec.go
+++ b/sql/postgres/sqlspec.go
@@ -82,7 +82,7 @@ func convertColumn(spec *sqlspec.Column, _ *schema.Table) (*schema.Column, error
 
 // convertColumnType converts a sqlspec.Column into a concrete Postgres schema.Type.
 func convertColumnType(spec *sqlspec.Column) (schema.Type, error) {
-	switch sqlspec.Type(spec.TypeName) {
+	switch sqlspec.Type(spec.Type) {
 	case sqlspec.TypeInt, sqlspec.TypeInt8, sqlspec.TypeInt16,
 		sqlspec.TypeInt64, sqlspec.TypeUint, sqlspec.TypeUint8,
 		sqlspec.TypeUint16, sqlspec.TypeUint64:
@@ -107,11 +107,11 @@ func convertColumnType(spec *sqlspec.Column) (schema.Type, error) {
 }
 
 func convertInteger(spec *sqlspec.Column) (schema.Type, error) {
-	if strings.HasPrefix(spec.TypeName, "u") {
+	if strings.HasPrefix(spec.Type, "u") {
 		return nil, fmt.Errorf("unsigned integers currently not supported")
 	}
 	typ := &schema.IntegerType{}
-	switch sqlspec.Type(spec.TypeName) {
+	switch sqlspec.Type(spec.Type) {
 	case sqlspec.TypeInt8:
 		return nil, fmt.Errorf("8-bit integers not supported")
 	case sqlspec.TypeInt16:
@@ -121,7 +121,7 @@ func convertInteger(spec *sqlspec.Column) (schema.Type, error) {
 	case sqlspec.TypeInt64:
 		typ.T = tBigInt
 	default:
-		return nil, fmt.Errorf("unknown integer column type %q", spec.TypeName)
+		return nil, fmt.Errorf("unknown integer column type %q", spec.Type)
 	}
 	return typ, nil
 }
@@ -197,13 +197,13 @@ func convertFloat(spec *sqlspec.Column) (schema.Type, error) {
 }
 
 func parseRawType(spec *sqlspec.Column) (schema.Type, error) {
-	d, err := parseColumn(spec.TypeName)
+	d, err := parseColumn(spec.Type)
 	if err != nil {
 		return nil, err
 	}
 	// Normalize PostgreSQL array data types from "CREATE TABLE" format to
 	// "INFORMATION_SCHEMA" format (i.e. as it is inspected from the database).
-	if t, ok := arrayType(spec.TypeName); ok {
+	if t, ok := arrayType(spec.Type); ok {
 		d = &columnDesc{typ: tArray, udt: t}
 	}
 	return columnType(d), nil
@@ -226,9 +226,9 @@ func columnSpec(col *schema.Column) (*sqlspec.Column, error) {
 		return nil, err
 	}
 	return &sqlspec.Column{
-		Name:     col.Name,
-		TypeName: ct.TypeName,
-		Null:     ct.Null,
+		Name: col.Name,
+		Type: ct.Type,
+		Null: ct.Null,
 		DefaultExtension: schemaspec.DefaultExtension{
 			Extra: schemaspec.Resource{Attrs: ct.DefaultExtension.Extra.Attrs},
 		},
@@ -249,34 +249,34 @@ func columnTypeSpec(t schema.Type) (*sqlspec.Column, error) {
 		scale := specutil.LitAttr("scale", strconv.Itoa(t.Scale))
 		return specutil.NewCol("", "decimal", precision, scale), nil
 	case *schema.BinaryType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.BoolType:
-		return &sqlspec.Column{TypeName: "boolean"}, nil
+		return &sqlspec.Column{Type: "boolean"}, nil
 	case *schema.FloatType:
 		precision := specutil.LitAttr("precision", strconv.Itoa(t.Precision))
 		return specutil.NewCol("", "float", precision), nil
 	case *schema.TimeType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.JSONType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.SpatialType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.UnsupportedType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *ArrayType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *BitType:
 		return bitSpec(t)
 	case *CurrencyType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *NetworkType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *SerialType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *UUIDType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *XMLType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	default:
 		return nil, fmt.Errorf("failed to convert column type %T to spec", t)
 	}
@@ -298,14 +298,14 @@ func integerSpec(t *schema.IntegerType) (*sqlspec.Column, error) {
 		if t.Unsigned {
 			return specutil.NewCol("", "uint"), nil
 		}
-		return &sqlspec.Column{TypeName: "int"}, nil
+		return &sqlspec.Column{Type: "int"}, nil
 	case tBigInt:
 		if t.Unsigned {
 			return specutil.NewCol("", "uint64"), nil
 		}
-		return &sqlspec.Column{TypeName: "int64"}, nil
+		return &sqlspec.Column{Type: "int64"}, nil
 	default:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	}
 }
 
@@ -325,14 +325,14 @@ func bitSpec(t *BitType) (*sqlspec.Column, error) {
 	switch t.T {
 	case tBit:
 		if t.Len == 1 {
-			c = &sqlspec.Column{TypeName: tBit}
+			c = &sqlspec.Column{Type: tBit}
 		} else {
 			c = specutil.NewCol("", fmt.Sprintf("%s(%d)", tBit, t.Len))
 		}
 		return c, nil
 	case tBitVar:
 		if t.Len == 0 {
-			c = &sqlspec.Column{TypeName: tBitVar}
+			c = &sqlspec.Column{Type: tBitVar}
 		} else {
 			c = specutil.NewCol("", fmt.Sprintf("%s(%d)", tBitVar, t.Len))
 		}
diff --git a/sql/sqlite/sqlspec.go b/sql/sqlite/sqlspec.go
index 2430588e..c970c16d 100644
--- a/sql/sqlite/sqlspec.go
+++ b/sql/sqlite/sqlspec.go
@@ -78,7 +78,7 @@ func convertColumn(spec *sqlspec.Column, _ *schema.Table) (*schema.Column, error
 
 // convertColumnType converts a sqlspec.Column into a concrete SQLite schema.Type.
 func convertColumnType(spec *sqlspec.Column) (schema.Type, error) {
-	switch sqlspec.Type(spec.TypeName) {
+	switch sqlspec.Type(spec.Type) {
 	case sqlspec.TypeInt, sqlspec.TypeInt8, sqlspec.TypeInt16,
 		sqlspec.TypeInt64, sqlspec.TypeUint, sqlspec.TypeUint8,
 		sqlspec.TypeUint16, sqlspec.TypeUint64:
@@ -98,12 +98,12 @@ func convertColumnType(spec *sqlspec.Column) (schema.Type, error) {
 	case sqlspec.TypeTime:
 		return convertTime(spec)
 	default:
-		return parseRawType(spec.TypeName)
+		return parseRawType(spec.Type)
 	}
 }
 
 func convertInteger(spec *sqlspec.Column) (schema.Type, error) {
-	if strings.HasPrefix(spec.TypeName, "u") {
+	if strings.HasPrefix(spec.Type, "u") {
 		// todo(rotemtam): support his once we can express CHECK(col >= 0)
 		return nil, fmt.Errorf("sqlite: unsigned integers currently not supported")
 	}
@@ -199,9 +199,9 @@ func columnSpec(col *schema.Column) (*sqlspec.Column, error) {
 		return nil, err
 	}
 	return &sqlspec.Column{
-		Name:     col.Name,
-		TypeName: ct.TypeName,
-		Null:     ct.Null,
+		Name: col.Name,
+		Type: ct.Type,
+		Null: ct.Null,
 		DefaultExtension: schemaspec.DefaultExtension{
 			Extra: schemaspec.Resource{Attrs: ct.DefaultExtension.Extra.Attrs},
 		},
@@ -223,18 +223,18 @@ func columnTypeSpec(t schema.Type) (*sqlspec.Column, error) {
 	case *schema.BinaryType:
 		return binarySpec(t)
 	case *schema.BoolType:
-		return &sqlspec.Column{TypeName: "boolean"}, nil
+		return &sqlspec.Column{Type: "boolean"}, nil
 	case *schema.FloatType:
 		precision := specutil.LitAttr("precision", strconv.Itoa(t.Precision))
 		return specutil.NewCol("", "float", precision), nil
 	case *schema.TimeType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.JSONType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.SpatialType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	case *schema.UnsupportedType:
-		return &sqlspec.Column{TypeName: t.T}, nil
+		return &sqlspec.Column{Type: t.T}, nil
 	default:
 		return nil, fmt.Errorf("sqlite: failed to convert column type %T to spec", t)
 	}
@@ -244,7 +244,7 @@ func binarySpec(t *schema.BinaryType) (*sqlspec.Column, error) {
 	if t.T != tBlob {
 		return nil, fmt.Errorf("sqlite/spec/binary: failed to convert type %q", t.T)
 	}
-	return &sqlspec.Column{TypeName: "binary"}, nil
+	return &sqlspec.Column{Type: "binary"}, nil
 }
 
 func stringSpec(t *schema.StringType) (*sqlspec.Column, error) {
@@ -262,7 +262,7 @@ func integerSpec(t *schema.IntegerType) (*sqlspec.Column, error) {
 	if t.T != tInteger {
 		return nil, fmt.Errorf("sqlite/spec/integer: failed to convert type %q", t.T)
 	}
-	return &sqlspec.Column{TypeName: "int"}, nil
+	return &sqlspec.Column{Type: "int"}, nil
 }
 
 func enumSpec(t *schema.EnumType) (*sqlspec.Column, error) {
diff --git a/sql/sqlspec/sqlspec.go b/sql/sqlspec/sqlspec.go
index fbec3449..39c86e0b 100644
--- a/sql/sqlspec/sqlspec.go
+++ b/sql/sqlspec/sqlspec.go
@@ -26,10 +26,10 @@ type (
 
 	// Column holds a specification for a column in an SQL table.
 	Column struct {
-		Name     string                   `spec:",name"`
-		Null     bool                     `spec:"null" override:"null"`
-		TypeName string                   `spec:"type" override:"type"`
-		Default  *schemaspec.LiteralValue `spec:"default" override:"default"`
+		Name    string                   `spec:",name"`
+		Null    bool                     `spec:"null" override:"null"`
+		Type    string                   `spec:"type" override:"type"`
+		Default *schemaspec.LiteralValue `spec:"default" override:"default"`
 		schemaspec.DefaultExtension
 	}
 


Test patch:
diff --git a/internal/integration/hclsqlspec/hclsqlspec_test.go b/internal/integration/hclsqlspec/hclsqlspec_test.go
index 83e63b15..acb502d1 100644
--- a/internal/integration/hclsqlspec/hclsqlspec_test.go
+++ b/internal/integration/hclsqlspec/hclsqlspec_test.go
@@ -114,28 +114,28 @@ table "accounts" {
 				SchemaName: "hi",
 				Columns: []*sqlspec.Column{
 					{
-						Name:     "id",
-						TypeName: "uint",
-						Null:     false,
-						Default:  &schemaspec.LiteralValue{V: "123"},
+						Name:    "id",
+						Type:    "uint",
+						Null:    false,
+						Default: &schemaspec.LiteralValue{V: "123"},
 					},
 					{
-						Name:     "age",
-						TypeName: "int",
-						Null:     false,
-						Default:  &schemaspec.LiteralValue{V: "10"},
+						Name:    "age",
+						Type:    "int",
+						Null:    false,
+						Default: &schemaspec.LiteralValue{V: "10"},
 					},
 					{
-						Name:     "active",
-						TypeName: "bool",
-						Null:     false,
-						Default:  &schemaspec.LiteralValue{V: "true"},
+						Name:    "active",
+						Type:    "bool",
+						Null:    false,
+						Default: &schemaspec.LiteralValue{V: "true"},
 					},
 					{
-						Name:     "account_active",
-						TypeName: "bool",
-						Null:     false,
-						Default:  &schemaspec.LiteralValue{V: "true"},
+						Name:    "account_active",
+						Type:    "bool",
+						Null:    false,
+						Default: &schemaspec.LiteralValue{V: "true"},
 					},
 				},
 				PrimaryKey: &sqlspec.PrimaryKey{
@@ -190,28 +190,28 @@ table "accounts" {
 				SchemaName: "hi",
 				Columns: []*sqlspec.Column{
 					{
-						Name:     "id",
-						TypeName: "uint",
-						Null:     false,
-						Default:  &schemaspec.LiteralValue{V: "123"},
+						Name:    "id",
+						Type:    "uint",
+						Null:    false,
+						Default: &schemaspec.LiteralValue{V: "123"},
 					},
 					{
-						Name:     "age",
-						TypeName: "int",
-						Null:     false,
-						Default:  &schemaspec.LiteralValue{V: "10"},
+						Name:    "age",
+						Type:    "int",
+						Null:    false,
+						Default: &schemaspec.LiteralValue{V: "10"},
 					},
 					{
-						Name:     "active",
-						TypeName: "bool",
-						Null:     false,
-						Default:  &schemaspec.LiteralValue{V: "true"},
+						Name:    "active",
+						Type:    "bool",
+						Null:    false,
+						Default: &schemaspec.LiteralValue{V: "true"},
 					},
 					{
-						Name:     "user_active",
-						TypeName: "bool",
-						Null:     false,
-						Default:  &schemaspec.LiteralValue{V: "true"},
+						Name:    "user_active",
+						Type:    "bool",
+						Null:    false,
+						Default: &schemaspec.LiteralValue{V: "true"},
 					},
 				},
 				PrimaryKey: &sqlspec.PrimaryKey{
@@ -316,9 +316,9 @@ table "accounts" {
 
 func TestMarshalTopLevel(t *testing.T) {
 	c := &sqlspec.Column{
-		Name:     "column",
-		Null:     true,
-		TypeName: "string",
+		Name: "column",
+		Null: true,
+		Type: "string",
 	}
 	h, err := schemahcl.Marshal(c)
 	require.NoError(t, err)
diff --git a/internal/integration/hclsqlspec/migrate_test.go b/internal/integration/hclsqlspec/migrate_test.go
index b02a11d3..e2f0b757 100644
--- a/internal/integration/hclsqlspec/migrate_test.go
+++ b/internal/integration/hclsqlspec/migrate_test.go
@@ -29,9 +29,9 @@ modify_table {
 		Changes: []sqlspec.Change{
 			&sqlspec.AddColumn{
 				Column: &sqlspec.Column{
-					Name:     "id",
-					Null:     false,
-					TypeName: "int",
+					Name: "id",
+					Null: false,
+					Type: "int",
 				},
 			},
 		},
diff --git a/sql/mysql/sqlspec_test.go b/sql/mysql/sqlspec_test.go
index c4174116..668e3c61 100644
--- a/sql/mysql/sqlspec_test.go
+++ b/sql/mysql/sqlspec_test.go
@@ -474,7 +474,7 @@ func TestMarshalSpecColumnType(t *testing.T) {
 			expected: specutil.NewCol("column", "year(4)"),
 		},
 	} {
-		t.Run(tt.expected.TypeName, func(t *testing.T) {
+		t.Run(tt.expected.Type, func(t *testing.T) {
 			s := schema.Schema{
 				Tables: []*schema.Table{
 					{
@@ -496,7 +496,7 @@ func TestMarshalSpecColumnType(t *testing.T) {
 			}
 			err = schemahcl.Unmarshal(ddl, &test)
 			require.NoError(t, err)
-			require.EqualValues(t, tt.expected.TypeName, test.Table.Columns[0].TypeName)
+			require.EqualValues(t, tt.expected.Type, test.Table.Columns[0].Type)
 			require.ElementsMatch(t, tt.expected.Extra.Attrs, test.Table.Columns[0].Extra.Attrs)
 		})
 	}
diff --git a/sql/postgres/sqlspec_test.go b/sql/postgres/sqlspec_test.go
index 9a9d97de..39ab107b 100644
--- a/sql/postgres/sqlspec_test.go
+++ b/sql/postgres/sqlspec_test.go
@@ -482,7 +482,7 @@ func TestMarshalSpecColumnType(t *testing.T) {
 			}
 			err = schemahcl.Unmarshal(ddl, &test)
 			require.NoError(t, err)
-			require.EqualValues(t, tt.expected.TypeName, test.Table.Columns[0].TypeName)
+			require.EqualValues(t, tt.expected.Type, test.Table.Columns[0].Type)
 			require.ElementsMatch(t, tt.expected.Extra.Attrs, test.Table.Columns[0].Extra.Attrs)
 		})
 	}
diff --git a/sql/sqlite/sqlspec_test.go b/sql/sqlite/sqlspec_test.go
index 85d7f9a2..2df05b37 100644
--- a/sql/sqlite/sqlspec_test.go
+++ b/sql/sqlite/sqlspec_test.go
@@ -328,7 +328,7 @@ func TestMarshalSpecColumnType(t *testing.T) {
 			expected: specutil.NewCol("column", "float", specutil.LitAttr("precision", "10")),
 		},
 	} {
-		t.Run(tt.expected.TypeName, func(t *testing.T) {
+		t.Run(tt.expected.Type, func(t *testing.T) {
 			s := schema.Schema{
 				Tables: []*schema.Table{
 					{
@@ -350,7 +350,7 @@ func TestMarshalSpecColumnType(t *testing.T) {
 			}
 			err = schemahcl.Unmarshal(ddl, &test)
 			require.NoError(t, err)
-			require.EqualValues(t, tt.expected.TypeName, test.Table.Columns[0].TypeName)
+			require.EqualValues(t, tt.expected.Type, test.Table.Columns[0].Type)
 			require.ElementsMatch(t, tt.expected.Extra.Attrs, test.Table.Columns[0].Extra.Attrs)
 		})
 	}
@@ -366,7 +366,7 @@ func TestNotSupportedMarshalSpecColumnType(t *testing.T) {
 			expected: specutil.NewCol("column", "int"),
 		},
 	} {
-		t.Run(tt.expected.TypeName, func(t *testing.T) {
+		t.Run(tt.expected.Type, func(t *testing.T) {
 			s := schema.Schema{
 				Tables: []*schema.Table{
 					{