MCPcopy Create free account
hub / github.com/apache/devlake / AddColumn

Method AddColumn

backend/impls/dalgorm/dalgorm.go:327–334  ·  view source on GitHub ↗

AddColumn add one column for the table

(table, columnName string, columnType dal.ColumnType)

Source from the content-addressed store, hash-verified

325
326// AddColumn add one column for the table
327func (d *Dalgorm) AddColumn(table, columnName string, columnType dal.ColumnType) errors.Error {
328 // work around the error `cached plan must not change result type` for postgres
329 // wrap in func(){} to make the linter happy
330 defer func() {
331 _ = d.Exec("SELECT * FROM ? LIMIT 1", clause.Table{Name: table})
332 }()
333 return d.Exec("ALTER TABLE ? ADD ? ?", clause.Table{Name: table}, clause.Column{Name: columnName}, clause.Expr{SQL: columnType.String()})
334}
335
336// DropColumns drop one column from the table
337func (d *Dalgorm) DropColumns(table string, columnNames ...string) errors.Error {

Callers

nothing calls this directly

Calls 2

ExecMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected