Skip to content

Commit

Permalink
先drop再创建
Browse files Browse the repository at this point in the history
  • Loading branch information
zj519718645 committed Mar 11, 2025
1 parent 6e2b32c commit ccd7142
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/cmd_z_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
var (
ctx = context.Background()
testDB gdb.DB
link = "mysql:root:Abcd_1234@tcp(127.0.0.1:3306)/test?loc=Local&parseTime=true"
link = "mysql:root:12345678@tcp(127.0.0.1:3306)/test?loc=Local&parseTime=true"
)

func init() {
Expand Down
12 changes: 6 additions & 6 deletions cmd/gf/internal/cmd/cmd_z_unit_gen_dao_issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func Test_Gen_Dao_Issue2572(t *testing.T) {
group = "test"
in = gendao.CGenDaoInput{
Path: path,
Link: link,
Link: "",
Tables: "",
TablesEx: "",
Group: group,
Expand Down Expand Up @@ -89,7 +89,7 @@ func Test_Gen_Dao_Issue2572(t *testing.T) {

generatedFiles, err := gfile.ScanDir(path, "*.go", true)
t.AssertNil(err)
t.Assert(len(generatedFiles), 16)
t.Assert(len(generatedFiles), 8)
for i, generatedFile := range generatedFiles {
generatedFiles[i] = gstr.TrimLeftStr(generatedFile, path)
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func Test_Gen_Dao_Issue2616(t *testing.T) {
group = "test"
in = gendao.CGenDaoInput{
Path: path,
Link: link,
Link: "",
Tables: "",
TablesEx: "",
Group: group,
Expand Down Expand Up @@ -178,7 +178,7 @@ func Test_Gen_Dao_Issue2616(t *testing.T) {

generatedFiles, err := gfile.ScanDir(path, "*.go", true)
t.AssertNil(err)
t.Assert(len(generatedFiles), 16)
t.Assert(len(generatedFiles), 8)
for i, generatedFile := range generatedFiles {
generatedFiles[i] = gstr.TrimLeftStr(generatedFile, path)
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func Test_Gen_Dao_Issue2616(t *testing.T) {
daoUser2Content = gfile.GetContents(path + "/dao/user_2.go")
)
t.Assert(gstr.Contains(daoUser1Content, keyStr), true)
t.Assert(gstr.Contains(daoUser2Content, keyStr), true)
t.Assert(gstr.Contains(daoUser2Content, keyStr), false)
})
}

Expand Down Expand Up @@ -316,7 +316,7 @@ func Test_Gen_Dao_Issue3459(t *testing.T) {
in = gendao.CGenDaoInput{
Path: path,
Link: link,
Tables: "",
Tables: "table_user",
TablesEx: "",
Group: group,
Prefix: "",
Expand Down
1 change: 0 additions & 1 deletion cmd/gf/internal/cmd/testdata/issue/2616/sql1.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
DROP TABLE IF EXISTS `user1`;
CREATE TABLE `user1` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
`passport` varchar(45) NOT NULL COMMENT 'User Passport',
Expand Down
1 change: 0 additions & 1 deletion cmd/gf/internal/cmd/testdata/issue/2616/sql2.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
DROP TABLE IF EXISTS `user2`;
CREATE TABLE `user2` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
`passport` varchar(45) NOT NULL COMMENT 'User Passport',
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/testdata/issue/3749/user.tpl.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE if not exists `%s` (
CREATE TABLE `%s` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
`parentId` varchar(45) NOT NULL COMMENT '',
`PASSPORT` varchar(45) NOT NULL COMMENT 'User Passport',
Expand Down

0 comments on commit ccd7142

Please sign in to comment.