When using `Preload` on a `many2many` association, the
`Query` callback chain was not being called. This made
it difficult to write a plugin that could reliably get
called regardless of how objects were being queried.
Now `handleManyToManyPreload` will call the `Query`
callback chain for each object that is retrieved by
following the association.
Since the data has already been read by the
`handleManyToManyPreload` method, a new scope setting
called `gorm:skip_queryCallback` is set to `true` before
calling the callbacks. Callbacks can check for the
presence of this setting if they should not be run; the
default `queryCallback` is an example of this case.
Fixesjinzhu/gorm#1621.
* DataTypeOf should now correctly identify dataValues that are 'json.RawMessage' types as 'jsonb' columns
* move the json check to its own function
* ran gofmt and did some minor tweaks to satisfy CodeClimate
* 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.
If a postgres database contains more than one
schema methods like HasTable(...) would return
true even if the current schema does not contain a
table with that name.
The integer type in postgres is 4 bytes. Since it is also signed, when using uint32 with high bit set you will get:
`pq: value "2854263694" is out of range for type integer`
To prevent this uint32 should be bigint in postgres.