Yan-Fa Li
8545f58824
No auto_inc of gorm:"primary_key" if foreignkey
...
If you are trying to create a table to store metadata about the
relationship of two entities, e.g. Product and Store and the quantity of
product available at that store. You may wish to use a composite foreign
key relationship.
If you also wish to use gorm to generate the SQL to create the schema,
but default gorm will add the auto_increment keyword to tables which are
both primary and integer. This is a undesirable for composite foreign
key relationships and generates invalid sql statements.
If you have a struct field which is a primary key and is marked as a
foreign key, disable the auto increment behavior while generating the
schema.
2015-07-02 11:03:54 -07:00
Jinzhu
b96ca76e59
Set table name handler
2015-05-27 12:19:48 +08:00
Jinzhu
b9a39be9c5
Add Tabler
2015-04-08 11:36:01 +08:00
Jinzhu
1e28551d25
Fix additional SQL type
2015-03-20 17:21:17 +08:00
Jinzhu
94a5ebe5b4
Refactor JoinTableHandler
2015-03-20 11:22:14 +08:00
Jinzhu
fa753969b1
Fix stack overflow
2015-03-19 16:31:11 +08:00
Jinzhu
c13e2f18f8
New JoinTableHandler
2015-03-18 11:47:11 +08:00
Jinzhu
df33db6ff9
Save cached model structs globally
2015-03-11 18:33:50 +08:00
Jinzhu
a549b6bd49
Refactor SQL Tag
2015-03-11 17:05:58 +08:00
Jinzhu
49454839bd
Support Multi primary keys
2015-03-11 11:28:30 +08:00
Jinzhu
b391029188
Fix stack overflow for many to many associations
2015-02-28 19:09:45 +08:00
Jinzhu
da8fc53c86
Set IsForeignKey for StructField
2015-02-28 15:54:38 +08:00
Jinzhu
087b7083ad
Fix scope Fields with embedded struct
2015-02-25 11:17:33 +08:00
Jinzhu
07af30c548
Fix primary key in embedded struct
2015-02-25 10:57:21 +08:00
Jinzhu
10340e6ad7
Support SQL expression
2015-02-24 22:06:35 +08:00
Jinzhu
406a01875c
Test using pointer as struct fields
2015-02-20 22:06:49 +08:00
Jinzhu
af7da1ec44
GetModelStruct without relations
2015-02-18 13:16:32 +08:00
Jinzhu
0d2c37e310
Refactor Model Struct
2015-02-18 12:50:37 +08:00
Jinzhu
9e5c64d611
Refactor model struct
2015-02-18 11:37:08 +08:00
Jinzhu
5c478b46e1
Use Common Initialisms from golint
2015-02-18 10:36:32 +08:00
Jinzhu
672ba4ffc9
Rename ToSnake to ToDBColumnName
2015-02-18 09:26:35 +08:00
Jinzhu
1ba5ce3bbc
Cache model struct with struct type
2015-02-18 09:01:43 +08:00
Jinzhu
73a0401678
Cache generated model structs
2015-02-17 23:18:12 +08:00
Jinzhu
0b32041135
Review and Refactor
2015-02-17 22:55:14 +08:00
Jinzhu
fcb6b06d22
Add Tag for Field
2015-02-17 18:52:10 +08:00
Jinzhu
a38f83527a
Fix all tests
2015-02-17 18:37:47 +08:00
Jinzhu
d6439f4147
Fix tests after refactor
2015-02-17 18:01:24 +08:00
Jinzhu
803343fbe5
Fix scope.getField
2015-02-17 14:30:37 +08:00
Jinzhu
de3f2a5c46
Refactor Fields
2015-02-16 17:47:07 +08:00
Jinzhu
2d866090e4
Fix get scanner type
2015-02-16 17:10:13 +08:00
Jinzhu
f4e705b749
Fix compile error
2015-02-16 16:42:01 +08:00
Jinzhu
3a73206010
Refactor model struct
2015-02-16 16:35:26 +08:00
Jinzhu
1726cebc2e
update
2015-02-16 12:04:46 +08:00