dialect/sql/schema: allow running migration concurrently without copying the tables (#4475)

This commit is contained in:
Ariel Mashraki
2025-12-11 22:32:32 +02:00
committed by GitHub
parent 49be309024
commit 397ebe9f39
3 changed files with 22 additions and 0 deletions

View File

@@ -1078,6 +1078,7 @@ func (a *Atlas) aIndexes(et *Table, at *schema.Table) error {
// are linked to their indexes, and PKs columns are defined.
func (a *Atlas) setupTables(tables []*Table) {
for _, t := range tables {
t.mu.Lock()
if t.columns == nil {
t.columns = make(map[string]*Column, len(t.Columns))
}
@@ -1101,6 +1102,7 @@ func (a *Atlas) setupTables(tables []*Table) {
fk.Columns[i].foreign = fk
}
}
t.mu.Unlock()
}
}