diff --git a/dialects/dameng.go b/dialects/dameng.go index fa168fbd..e39e8f1d 100644 --- a/dialects/dameng.go +++ b/dialects/dameng.go @@ -574,7 +574,7 @@ func (db *dameng) SQLType(c *schemas.Column) string { switch t := c.SQLType.Name; t { case schemas.TinyInt, "BYTE": return "TINYINT" - case schemas.SmallInt, schemas.MediumInt, schemas.Int, schemas.Integer: + case schemas.SmallInt, schemas.MediumInt, schemas.Int, schemas.Integer, schemas.UnsignedTinyInt: return "INTEGER" case schemas.BigInt, schemas.UnsignedBigInt, schemas.UnsignedBit, schemas.UnsignedInt, @@ -663,7 +663,7 @@ func (db *dameng) DropTableSQL(tableName string) (string, bool) { // ModifyColumnSQL returns a SQL to modify SQL func (db *dameng) ModifyColumnSQL(tableName string, col *schemas.Column) string { s, _ := ColumnString(db.dialect, col, false) - return fmt.Sprintf("ALTER TABLE %s MODIFY %s", tableName, s) + return fmt.Sprintf("ALTER TABLE %s MODIFY %s", db.quoter.Quote(tableName), s) } func (db *dameng) CreateTableSQL(ctx context.Context, queryer core.Queryer, table *schemas.Table, tableName string) (string, bool, error) { diff --git a/integrations/types_test.go b/integrations/types_test.go index b08dfec5..5079ec75 100644 --- a/integrations/types_test.go +++ b/integrations/types_test.go @@ -507,7 +507,7 @@ func TestUnsignedTinyInt(t *testing.T) { assert.EqualValues(t, 1, len(tables[0].Columns())) switch testEngine.Dialect().URI().DBType { - case schemas.SQLITE: + case schemas.SQLITE, schemas.DAMENG: assert.EqualValues(t, "INTEGER", tables[0].Columns()[0].SQLType.Name) case schemas.MYSQL: assert.EqualValues(t, "UNSIGNED TINYINT", tables[0].Columns()[0].SQLType.Name) @@ -516,7 +516,7 @@ func TestUnsignedTinyInt(t *testing.T) { case schemas.MSSQL: assert.EqualValues(t, "INT", tables[0].Columns()[0].SQLType.Name) default: - assert.False(t, true, "Unsigned is not implemented") + assert.False(t, true, fmt.Sprintf("Unsigned is not implemented, returned %s", tables[0].Columns()[0].SQLType.Name)) } cnt, err := testEngine.Insert(&MyUnsignedTinyIntStruct{