File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -109,10 +109,12 @@ func (p *processor) Execute(db *DB) {
109109 }
110110
111111 // call scopes
112- scopes := stmt .scopes
113- stmt .scopes = nil
114- for _ , scope := range scopes {
115- db = scope (db )
112+ for len (stmt .scopes ) > 0 {
113+ scopes := stmt .scopes
114+ stmt .scopes = nil
115+ for _ , scope := range scopes {
116+ db = scope (db )
117+ }
116118 }
117119
118120 for _ , f := range p .fns {
Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ import (
88// Migrator returns migrator
99func (db * DB ) Migrator () Migrator {
1010 // apply scopes to migrator
11- scopes := db .Statement .scopes
12- db .Statement .scopes = nil
13- for _ , scope := range scopes {
14- db = scope (db )
11+ for len (db .Statement .scopes ) > 0 {
12+ scopes := db .Statement .scopes
13+ db .Statement .scopes = nil
14+ for _ , scope := range scopes {
15+ db = scope (db )
16+ }
1517 }
1618
1719 return db .Dialector .Migrator (db .Session (& Session {}))
You can’t perform that action at this time.
0 commit comments