Fix bug
This commit is contained in:
parent
284443565d
commit
e3d8312b07
|
@ -288,7 +288,7 @@ func (db *mysql) IndexCheckSQL(tableName, idxName string) (string, []interface{}
|
||||||
|
|
||||||
func (db *mysql) IsTableExist(ctx context.Context, tableName string) (bool, error) {
|
func (db *mysql) IsTableExist(ctx context.Context, tableName string) (bool, error) {
|
||||||
sql := "SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=?"
|
sql := "SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=?"
|
||||||
return db.HasRecords(ctx, sql)
|
return db.HasRecords(ctx, sql, db.uri.DBName, tableName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *mysql) AddColumnSQL(tableName string, col *schemas.Column) string {
|
func (db *mysql) AddColumnSQL(tableName string, col *schemas.Column) string {
|
||||||
|
|
|
@ -944,10 +944,10 @@ func (db *postgres) IndexCheckSQL(tableName, idxName string) (string, []interfac
|
||||||
|
|
||||||
func (db *postgres) IsTableExist(ctx context.Context, tableName string) (bool, error) {
|
func (db *postgres) IsTableExist(ctx context.Context, tableName string) (bool, error) {
|
||||||
if len(db.uri.Schema) == 0 {
|
if len(db.uri.Schema) == 0 {
|
||||||
return db.HasRecords(ctx, `SELECT tablename FROM pg_tables WHERE tablename = ?`, tableName)
|
return db.HasRecords(ctx, `SELECT tablename FROM pg_tables WHERE tablename = $1`, tableName)
|
||||||
}
|
}
|
||||||
|
|
||||||
return db.HasRecords(ctx, `SELECT tablename FROM pg_tables WHERE schemaname = ? AND tablename = ?`,
|
return db.HasRecords(ctx, `SELECT tablename FROM pg_tables WHERE schemaname = $1 AND tablename = $2`,
|
||||||
db.uri.Schema, tableName)
|
db.uri.Schema, tableName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue