Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
gluetidb: fix failure to create schema
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm committed Apr 1, 2020
1 parent 15d9a25 commit 5c280d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/gluetidb/glue.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"

"github.com/pingcap/parser/model"
"github.com/pingcap/parser/mysql"
pd "github.com/pingcap/pd/v4/client"
"github.com/pingcap/tidb/ddl"
"github.com/pingcap/tidb/domain"
Expand Down Expand Up @@ -63,7 +64,11 @@ func (gs *tidbSession) Execute(ctx context.Context, sql string) error {
// CreateDatabase implements glue.Session
func (gs *tidbSession) CreateDatabase(ctx context.Context, schema *model.DBInfo) error {
d := domain.GetDomain(gs.se).DDL()
return d.CreateSchemaWithInfo(gs.se, schema.Clone(), ddl.OnExistIgnore, true)
schema = schema.Clone()
if len(schema.Charset) == 0 {
schema.Charset = mysql.DefaultCharset
}
return d.CreateSchemaWithInfo(gs.se, schema, ddl.OnExistIgnore, true)
}

// CreateTable implements glue.Session
Expand Down

0 comments on commit 5c280d8

Please sign in to comment.