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 {
134134 return fmt .Errorf ("bad configuration item(%s) of the right table" , "diff cols" )
135135 }
136136 }
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+ }
137146 maxKey := func (db * gorm.DB , table string ) (int64 , error ) {
138147 id := int64 (0 )
139148 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) {
181181 }
182182 res = append (res , row )
183183 }
184- //spew.Dump(res)
185184 return res , err
186185 }
187186 var (
You can’t perform that action at this time.
0 commit comments