Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
plan: return types in lowercase in SHOW CREATE TABLE (#827)
Browse files Browse the repository at this point in the history
plan: return types in lowercase in SHOW CREATE TABLE
  • Loading branch information
ajnavarro authored Oct 1, 2019
2 parents d434557 + 3cc02d2 commit b09e8c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sql/plan/show_create_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func produceCreateStatement(table sql.Table) string {

// Statement creation parts for each column
for i, col := range schema {
stmt := fmt.Sprintf(" `%s` %s", col.Name, sql.MySQLTypeName(col.Type))
stmt := fmt.Sprintf(" `%s` %s", col.Name, strings.ToLower(sql.MySQLTypeName(col.Type)))

if !col.Nullable {
stmt = fmt.Sprintf("%s NOT NULL", stmt)
Expand Down
6 changes: 3 additions & 3 deletions sql/plan/show_create_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ func TestShowCreateTable(t *testing.T) {

expected := sql.NewRow(
table.Name(),
"CREATE TABLE `test-table` (\n `baz` TEXT NOT NULL,\n"+
" `zab` INTEGER DEFAULT 0,\n"+
" `bza` BIGINT UNSIGNED DEFAULT 0\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4",
"CREATE TABLE `test-table` (\n `baz` text NOT NULL,\n"+
" `zab` integer DEFAULT 0,\n"+
" `bza` bigint unsigned DEFAULT 0\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4",
)

require.Equal(expected, row)
Expand Down

0 comments on commit b09e8c1

Please sign in to comment.