Browse Source
Merge pull request #2741 from zhuqunzhou/master
fix:support some databases which not support 'IF NOT EXISTS' keyword.
pull/2744/head
Chris Lu
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
1 deletions
-
weed/filer/mysql2/mysql2_store.go
|
|
@ -4,6 +4,7 @@ import ( |
|
|
|
"context" |
|
|
|
"database/sql" |
|
|
|
"fmt" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/filer" |
|
|
@ -82,7 +83,7 @@ func (store *MysqlStore2) initialize(createTable, upsertQuery string, enableUpse |
|
|
|
return fmt.Errorf("connect to %s error:%v", sqlUrl, err) |
|
|
|
} |
|
|
|
|
|
|
|
if err = store.CreateTable(context.Background(), abstract_sql.DEFAULT_TABLE); err != nil { |
|
|
|
if err = store.CreateTable(context.Background(), abstract_sql.DEFAULT_TABLE); err != nil && !strings.Contains(err.Error(), "table already exist") { |
|
|
|
return fmt.Errorf("init table %s: %v", abstract_sql.DEFAULT_TABLE, err) |
|
|
|
} |
|
|
|
|
|
|
|