File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,15 @@ func (c *config) checkAndFix() error {
134
134
return fmt .Errorf ("bad configuration item(%s) of the right table" , "diff cols" )
135
135
}
136
136
}
137
+ contain := false
138
+ for _ , col := range c .DiffColumns {
139
+ if col == c .PrimaryKey {
140
+ contain = true
141
+ }
142
+ }
143
+ if ! contain {
144
+ c .DiffColumns = append (c .DiffColumns , c .PrimaryKey )
145
+ }
137
146
maxKey := func (db * gorm.DB , table string ) (int64 , error ) {
138
147
id := int64 (0 )
139
148
row := db .Raw (fmt .Sprintf ("SELECT max(%s) FROM `%s`" , c .PrimaryKey , table )).Row ()
Original file line number Diff line number Diff line change @@ -181,7 +181,6 @@ func (d *differ) diff() (err error) {
181
181
}
182
182
res = append (res , row )
183
183
}
184
- //spew.Dump(res)
185
184
return res , err
186
185
}
187
186
var (
You can’t perform that action at this time.
0 commit comments