Commit Graph

1750 Commits

Author SHA1 Message Date
Jinzhu 2e5d98a420 Update wercker.yml 2018-02-10 11:45:38 +08:00
Jinzhu e0f9087c8d Setup test env 2018-02-10 11:07:07 +08:00
Jinzhu ae509ab237 Port AUTO_INCREMENT false support to mssql 2018-02-10 08:30:05 +08:00
Jinzhu bec55f84c6 Merge branch 'WingGao-wing' 2018-02-10 08:24:51 +08:00
Jinzhu 2c68f695c3 Set AutoIncrement to false with tag 2018-02-10 08:24:39 +08:00
Wing Gao 97495a5e40 Add new tag "not_auto_increment" to set a column can auto increase or not 2018-02-10 08:18:35 +08:00
Jinzhu 77eb925ea0 Refactor preloading many2many for auto preload 2018-02-10 00:07:16 +08:00
Geoff Baskwill ec72a4cb6b Call Query callback chain when preloading many2many (#1622)
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.

Fixes jinzhu/gorm#1621.
2018-02-09 23:22:53 +08:00
Jinzhu 2bb1b7c83e Merge branch 'miya-masa-master' 2018-02-09 23:19:35 +08:00
Jinzhu 8d4e3e5a83 Use tag PRECISION to set time's precision for mysql 2018-02-09 23:18:47 +08:00
miyauchi ae696d051f corresponds timestamp precision for mysql 2018-02-09 23:05:15 +08:00
Jinzhu 89a726ce5d Move ModifyColumn implemention to Dialect 2018-02-09 22:58:34 +08:00
Jinzhu e9309d361f Fix build exception 2018-02-09 22:34:59 +08:00
Amit Yadav 0e1cb6ece9 Add support to remove foreign key constraints (#1686) 2018-02-09 22:20:26 +08:00
daisy1754 38f96c6514 Add handling for empty Jsonb to fix #1649 (#1650) 2018-02-09 21:59:33 +08:00
Adrian Heng 48e41440af Allow for proper table creation with Jsonb fields (#1758)
* 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
2018-02-09 08:22:30 +08:00
Louis Tran 3f98904fe7 Update PULL_REQUEST_TEMPLATE.md, A vs. An (#1757)
Only a small change.

`a` agreement => `an` agreement
2018-02-09 08:21:39 +08:00
Jinzhu 87fc1b2473 Refactor PR #1751 2018-02-03 20:27:19 +08:00
Piyush Mishra 57f031e083 Use table name to guess current database if none is given 2018-02-02 22:29:40 +05:30
Jinzhu 802104cc7c Use BuildKeyName to build db's index name 2018-02-02 22:01:31 +08:00
Jinzhu ca46ec0770 Smaller image 2018-01-31 18:22:30 +08:00
Jinzhu cbc3d3cd50 Add go report card 2018-01-31 18:16:20 +08:00
Jinzhu 1856135e10 Merge branch 'WingGao-path1' 2018-01-31 17:14:33 +08:00
Jinzhu 630c12b549 Refactor #1693 2018-01-31 17:14:21 +08:00
s-takehana b9035a7602 Fix regex in BuildForeignKeyName #1681 (#1728) 2018-01-31 17:10:26 +08:00
rightjoin a2c7c4b63f UID should come before UI in common abbreviations (#1678)
This will fix the following issue
https://github.com/jinzhu/gorm/issues/1460
2018-01-31 17:08:03 +08:00
s-takehana 2ff44ee8d7 Fix regex in BuildForeignKeyName #1681 (#1728) 2018-01-31 16:32:36 +08:00
Wing Gao 26262ef9bb autoIndex should throw an error on failed 2017-11-28 13:05:48 +08:00
Aetheus 0a51f6cdc5 add JSONB type (#1626)
* add JSONB type

* add comments to satisfy gofmt
2017-10-10 08:28:39 -05:00
Konrad Kleine 9c9de89686 Use log.PrintX instead of fmt.PrintX (#1634) 2017-10-10 08:04:23 -05:00
Horacio Duran 3a9e91ab37 Correct ModifyColumn SQL syntax. (#1614)
* 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.
2017-09-28 22:48:21 +08:00
Cedric GESTES b1885a643b Support cloudsqlpostgres dialect (#1577)
This is needed for proper cloud sql proxy.

see https://github.com/GoogleCloudPlatform/cloudsql-proxy and https://github.com/GoogleCloudPlatform/cloudsql-proxy/blob/master/proxy/dialers/postgres/hook_test.go for details.
2017-09-04 22:39:19 +08:00
Domen Ipavec c0ac6a7d50 Do not ignore order on distinct query (#1570) 2017-09-04 22:35:37 +08:00
Teppei Fukuda 6e456250f7 Erros skip nil in Add function (#1566) 2017-09-04 22:25:57 +08:00
Dhiver 981d5db663 Fix postgres dialect UUID sqlType evaluation (#1564) 2017-09-04 22:23:42 +08:00
Lukas Dietrich 750fd9030a Fix postgres dialect for dbs with multiple schemas (#1558)
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.
2017-09-04 22:22:02 +08:00
Code 56fffcb25b fix count() …
COUNT()函数逻辑有错误,本应该是在执行任何SQL的时候,都可以返回正确的行数。而现在复杂的SQL集合无法正确获取行数。
2017-08-29 18:50:40 +08:00
Jinzhu c3bb6aaa82 Fix QueryExpr tests 2017-08-11 23:24:00 +08:00
Jinzhu e5432b14d2 Add QueryExpr, thanks @ManReinsp for PR #1548 2017-08-11 18:41:04 +08:00
Jinzhu d61b7db8fa Fix postgres tests 2017-08-11 18:03:32 +08:00
Jinzhu 969ab67636 [mssql] Fix save time struct's timezone 2017-08-11 17:18:49 +08:00
Kyle Spraggs 6f64b8610d Update callback_query_preload.go (#1553) 2017-08-02 07:05:11 +08:00
Jinzhu 35fb16eeba Don't overwrite existing timestamp when creating 2017-07-31 17:26:36 +08:00
Ivan Valkov 5b8c0dd6b9 Changed the type of uint32 from integer to bigint in postgres (#1536)
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.
2017-07-23 16:05:43 +08:00
liu-xuewen 10e217e2bc Print affected rows (#1541)
* fix better

* add the rows number that the sql result affected or returned
2017-07-23 16:04:22 +08:00
Ivan Valkov 2a1463811e Allow use number as column name (#1517)
* 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
2017-07-03 21:49:54 +08:00
Jinzhu d510c7e4b8 mysql only accept offset with limit together 2017-07-03 11:58:01 +08:00
Jinzhu d395b35025 mysql only accept offset with limit together 2017-07-03 11:26:31 +08:00
Jinzhu eae7f6be60 Fix source type is incorrect error for embedded many to many relationship 2017-06-14 17:33:21 +08:00
Jinzhu 9acaa33324 Merge pull request #1451 from ModelRocket/master
gorm:auto_preload setting to enable auto preloading associations
2017-05-04 22:08:37 +08:00