@@ -29,12 +29,14 @@ type Inspector struct {
2929 db * gosql.DB
3030 informationSchemaDb * gosql.DB
3131 migrationContext * base.MigrationContext
32+ name string
3233}
3334
3435func NewInspector (migrationContext * base.MigrationContext ) * Inspector {
3536 return & Inspector {
3637 connectionConfig : migrationContext .InspectorConnectionConfig ,
3738 migrationContext : migrationContext ,
39+ name : "inspector" ,
3840 }
3941}
4042
@@ -198,7 +200,7 @@ func (this *Inspector) validateConnection() error {
198200 return fmt .Errorf ("MySQL replication length limited to 32 characters. See https://dev.mysql.com/doc/refman/5.7/en/assigning-passwords.html" )
199201 }
200202
201- version , err := base .ValidateConnection (this .db , this .connectionConfig , this .migrationContext )
203+ version , err := base .ValidateConnection (this .db , this .connectionConfig , this .migrationContext , this . name )
202204 this .migrationContext .InspectorMySQLVersion = version
203205 return err
204206}
@@ -553,6 +555,7 @@ func (this *Inspector) applyColumnTypes(databaseName, tableName string, columnsL
553555 err := sqlutils .QueryRowsMap (this .db , query , func (m sqlutils.RowMap ) error {
554556 columnName := m .GetString ("COLUMN_NAME" )
555557 columnType := m .GetString ("COLUMN_TYPE" )
558+ columnOctetLength := m .GetUint ("CHARACTER_OCTET_LENGTH" )
556559 for _ , columnsList := range columnsLists {
557560 column := columnsList .GetColumn (columnName )
558561 if column == nil {
@@ -580,6 +583,10 @@ func (this *Inspector) applyColumnTypes(databaseName, tableName string, columnsL
580583 if strings .HasPrefix (columnType , "enum" ) {
581584 column .Type = sql .EnumColumnType
582585 }
586+ if strings .HasPrefix (columnType , "binary" ) {
587+ column .Type = sql .BinaryColumnType
588+ column .BinaryOctetLength = columnOctetLength
589+ }
583590 if charset := m .GetString ("CHARACTER_SET_NAME" ); charset != "" {
584591 column .Charset = charset
585592 }
0 commit comments