dialect/sql/schema: no longer allocate a PK range for a join table (#2950)

* dialect/sql/schema: no longer allocate a PK range for a join table

* test that no breaking change is introduced
This commit is contained in:
Jannik Clausen
2022-09-23 12:40:36 +02:00
committed by GitHub
parent 0f5cba6144
commit 139725ee00
2 changed files with 141 additions and 18 deletions

View File

@@ -803,7 +803,7 @@ func (a *Atlas) tables(tables []*Table) ([]*schema.Table, error) {
for i, et := range tables {
at := schema.NewTable(et.Name)
a.sqlDialect.atTable(et, at)
if a.universalID && et.Name != TypeTable {
if a.universalID && et.Name != TypeTable && len(et.PrimaryKey) == 1 {
r, err := a.pkRange(et)
if err != nil {
return nil, err