Fix the indexing logic used in selectedColumnsMap to skip fields
that have already been seen. The values of selectedColumns map
must be indexed relative to fields, not relative to selectFields.
* Edit DB.clone(), DB.Dialect(), and Scope.Dialect() preserve transactions.
* Adds a test case for tables creations and autoMigrate in the same transaction.
* Correct ModifyColumn SQL syntax.
The generated SQL for ModifyColumn was:
`ALTER TABLE "tablename" MODIFY "columname" type`
But should have been:
`ALTER TABLE "tablename" ALTER COLUMN "columname" TYPE type`
since Modify does not seem to be entirely compatible with all Engines
* Test ModifyColumn
* Skip ModifyColumnType test on incompatible DBs
Some DB Engines don't fully support alter table so we skip
when the dialect does not correspond to one of the ones that
are known to support it.
* Updated scope.go to always quote when adding index
I am using numbers for column names (to be compatible with protobuf) and adding unique index to them does not work since they are not quoted. I do not see a reason to check if the column name is a string in order to quote it. Correct me if I am wrong.
* Updated the columnRegexp to include decimals
* Update scope.go
Exporting sqlCommon as SQLCommon.
This allows passing alternate implementations of the database connection, or wrapping the connection with middleware. This change didn't change any usages of the database variables. All usages were already only using the functions defined in SQLCommon.
This does cause a breaking change in Dialect, since *sql.DB was referenced in the interface.
this fixes the logic of handling empty slice of int family in a query i.e something linke `[]int64{}`
This code snipped doesn't look like it was intended to be this way
```
if reflect.ValueOf(value).Len() > 0 {
str = fmt.Sprintf("(%v.%v NOT IN (?))", scope.QuotedTableName(), scope.Quote(primaryKey))
clause["args"] = []interface{}{value}
}
return ""
```
The `return ""` is always guaranteed to be executed regardless of whether the length of value is greater than 0. I believe the intended behavior is to return `""` when the length of value is zero.