dialect/sql/schema: alter table for postgres

Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/115

Reviewed By: alexsn

Differential Revision: D18065988

fbshipit-source-id: a7d33bbebd63b01659bc5ba562ac85642dcd3d83
This commit is contained in:
Ariel Mashraki
2019-10-22 12:54:04 -07:00
committed by Facebook Github Bot
parent dff3067639
commit 2789257849
4 changed files with 47 additions and 9 deletions

View File

@@ -191,7 +191,7 @@ func (m *Migrate) apply(ctx context.Context, tx dialect.Tx, table string, change
}
}
}
b := sql.AlterTable(table)
b := sql.Dialect(m.Dialect()).AlterTable(table)
for _, c := range change.column.add {
b.AddColumn(m.cBuilder(c))
}
@@ -200,7 +200,7 @@ func (m *Migrate) apply(ctx context.Context, tx dialect.Tx, table string, change
}
if m.dropColumn {
for _, c := range change.column.drop {
b.DropColumn(sql.Column(c.Name))
b.DropColumn(sql.Dialect(m.Dialect()).Column(c.Name))
}
}
// if there's actual action to execute on ALTER TABLE.