fix only add column if not exists for mysql
This commit is contained in:
@@ -108,6 +108,12 @@ func (db *Mysql) IndexCheckSql(tableName, indexName string) (string, []interface
|
||||
return sql, args
|
||||
}
|
||||
|
||||
func (db *Mysql) ColumnCheckSql(tableName, columnName string) (string, []interface{}) {
|
||||
args := []interface{}{tableName, columnName}
|
||||
sql := "SELECT 1 FROM " + db.Quote("INFORMATION_SCHEMA") + "." + db.Quote("COLUMNS") + " WHERE " + db.Quote("TABLE_SCHEMA") + " = DATABASE() AND " + db.Quote("TABLE_NAME") + "=? AND " + db.Quote("COLUMN_NAME") + "=?"
|
||||
return sql, args
|
||||
}
|
||||
|
||||
func (db *Mysql) CleanDB() error {
|
||||
tables, _ := db.engine.DBMetas()
|
||||
sess := db.engine.NewSession()
|
||||
|
||||
Reference in New Issue
Block a user