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

Commit b09e8c1

Browse files
authored
plan: return types in lowercase in SHOW CREATE TABLE (#827)
plan: return types in lowercase in SHOW CREATE TABLE
2 parents d434557 + 3cc02d2 commit b09e8c1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: sql/plan/show_create_table.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func produceCreateStatement(table sql.Table) string {
9191

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

9696
if !col.Nullable {
9797
stmt = fmt.Sprintf("%s NOT NULL", stmt)

Diff for: sql/plan/show_create_table_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ func TestShowCreateTable(t *testing.T) {
3737

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

4545
require.Equal(expected, row)

0 commit comments

Comments
 (0)