-
Notifications
You must be signed in to change notification settings - Fork 188
loader: generate db-schema-create.sql file if not exists #186
Conversation
Codecov Report
@@ Coverage Diff @@
## master #186 +/- ##
================================================
- Coverage 53.2932% 53.2504% -0.0429%
================================================
Files 121 121
Lines 13816 13829 +13
================================================
+ Hits 7363 7364 +1
- Misses 5709 5717 +8
- Partials 744 748 +4 |
loader/util.go
Outdated
} | ||
defer file.Close() | ||
|
||
file.WriteString(fmt.Sprintf("CREATE DATABASE `%s`;\n", schema)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use fmt.Fprintf
?
What if schema
contains a `
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also need to check error returned from fmt.Fprintf
or file.WriteString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 25659ee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have any suggestion when schema contains `? @kennytm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a function somewhere which replaces `
with ``
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in d87c959
PTAL again
Co-Authored-By: kennytm <kennytm@gmail.com>
…nto xiang/refine_loader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What problem does this PR solve?
mydumper will not dump schema create sql sometimes, and then loader will return error.
fix issue https://internal.pingcap.net/jira/browse/TOOL-1316
What is changed and how it works?
create schema create sql file if not find
Check List
Tests
Related changes