Commit Graph

2424 Commits

Author SHA1 Message Date
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
Rob Rodriguez e470b44fa8 adding gorm:auto_preload option and related tests 2017-04-27 15:53:39 -07:00
Jinzhu 717654b31c Merge pull request #1420 from ModelRocket/master
Adding more complete binary support for standard dialects
2017-04-19 15:35:50 +08:00
Rob Rodriguez bae0799bd8 Adding better binary type support for common SQL dialects 2017-04-19 00:21:56 -07:00
Jinzhu 08dba5378e Fix typo in tests 2017-04-19 10:17:29 +08:00
Jinzhu a870874bb5 Accept 0 as a value for Limit, Offset 2017-04-18 23:32:31 +08:00
Jinzhu b21c0bef9b Merge pull request #1412 from slayer/master
prevent nil pointer dereference on closed connection
2017-04-18 22:53:27 +08:00
Jinzhu abf1fc7808 Merge pull request #1408 from Konboi/fix/util-to-db-name
Fix ToDBName method
2017-04-18 22:49:33 +08:00
Jinzhu 33aa952d07 Merge pull request #1423 from emil2k/open-tx
Allow open to take transaction.
2017-04-18 22:22:24 +08:00
Emil Davtyan 5ed4c3f290 Allow open to take transaction.
Need to skip the ping, otherwise results in a nil dereference.
2017-04-18 15:33:13 +02:00
Jinzhu 88a47176f3 Use tinyint to int8 2017-04-18 17:16:10 +08:00
Jinzhu 2a041971f9 Change bind var to 24652$ to avoid possible confliction 2017-04-18 16:13:02 +08:00
Jinzhu d7c35d5141 Update issue, pull request template 2017-04-18 15:50:22 +08:00
Jinzhu 848d68aa04 Add issue, pull request template 2017-04-18 15:41:49 +08:00
Jinzhu 5b509264e1 Merge pull request #1438 from tux-mind/master
DB errors over NotFound
2017-04-17 10:34:52 +08:00
tux-mind 1eb3a5ae97 DB errors over NotFound
Errors comings from DB have higher priority than logic ones
2017-04-16 21:15:51 +02:00
Vladislav Moskovets 72a60c5df4 prevent nil pointer dereference on closed connection 2017-03-31 14:26:51 +03:00
Konboi 0493e786b8 Fix ToDBName method
from FiledX > fieldx to FieldX > field_x
2017-03-30 11:48:50 +09:00
Jinzhu 45ccb13437 Merge pull request #1401 from ginodeis/fix-empty-string-order
Fix empty string as order/sort clause
2017-03-27 23:13:47 +08:00
Tino Diaz d03afd173f Fix empty string as order clause 2017-03-26 14:00:34 +01:00
Jinzhu 66d5b42ee9 Add error if exists after parse raw query results, fix #1398 2017-03-24 09:28:06 +08:00
Jinzhu 403487d5dd Setup mssql test env 2017-03-22 23:50:42 +08:00
Jinzhu 5730b92954 Fix tests with mssql 2017-03-22 23:50:42 +08:00
John Mick 66982a7047 Remove SET_IDENTITY_INSERT for transactions in MS SQL
SET_IDENTITY_INSERT should be handled by each individual developer to avoid extra queries to the database.
2017-03-22 23:50:42 +08:00
Jinzhu 572d0a0ab1 Merge pull request #1376 from bt/master
Remove 'sqlite' dialect registration
2017-03-16 22:16:41 +08:00
Jinzhu 8b058a707f Merge pull request #1384 from ansel1/master
Replace all use of *sql.DB with sqlCommon
2017-03-16 22:15:57 +08:00
Russ Egan 45f1a95051 Replace all use of *sql.DB with sqlCommon
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.
2017-03-14 17:02:14 -04:00