Commit Graph

2311 Commits

Author SHA1 Message Date
Emil Davtyan c0359226dc Removed unnecessary cloning. (#1462)
`NewScope` clones `DB` no need to chain a call to clone with `NewScope`.
2018-02-10 19:31:55 +08:00
Jinzhu c6ce739b2a Convert auto_increment's value to lower case when checking its value 2018-02-10 19:25:58 +08:00
Jinzhu 2940c553eb Add DB setting gorm:association_save_reference 2018-02-10 18:01:41 +08:00
Jinzhu b2b568daa8 Add tag association_autoupdate, association_autocreate, association_save_reference support 2018-02-10 17:34:02 +08:00
Jinzhu 43dc867644 Allow save association relations w/o saving association 2018-02-10 17:34:02 +08:00
Ezequiel Muns 63cb513b49 Tests for saving foreign key when save_associations:false 2018-02-10 17:34:02 +08:00
joe-at-startupmedia 9f409820df Formatting code with gomt 2018-02-10 17:34:02 +08:00
joe-at-startupmedia 9235b47ea2 Allows foreign keys to be saved without saving the assoication when specified #1628 2018-02-10 17:34:02 +08:00
Jess Smith aa3fd6de13 Sort column names before generating SQL in `DB.UpdateColumns` (#1734) 2018-02-10 14:26:01 +08:00
Jinzhu 21fb3ae1fe Simplify GitHub templates 2018-02-10 13:55:11 +08:00
Giuseppe 706b8f55da Use brackets for quoting (#1736) 2018-02-10 12:28:01 +08:00
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