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

Method RenameColumn

backend/impls/dalgorm/dalgorm.go:361–373  ·  view source on GitHub ↗

RenameColumn renames column name for specified table

(table, oldColumnName, newColumnName string)

Source from the content-addressed store, hash-verified

359
360// RenameColumn renames column name for specified table
361func (d *Dalgorm) RenameColumn(table, oldColumnName, newColumnName string) errors.Error {
362 // work around the error `cached plan must not change result type` for postgres
363 // wrap in func(){} to make the linter happy
364 defer func() {
365 _ = d.Exec("SELECT * FROM ? LIMIT 1", clause.Table{Name: table})
366 }()
367 return d.Exec(
368 "ALTER TABLE ? RENAME COLUMN ? TO ?",
369 clause.Table{Name: table},
370 clause.Column{Name: oldColumnName},
371 clause.Column{Name: newColumnName},
372 )
373}
374
375// ModifyColumnType modify column type
376func (d *Dalgorm) ModifyColumnType(table, columnName, columnType string) errors.Error {

Callers

nothing calls this directly

Calls 1

ExecMethod · 0.95

Tested by

no test coverage detected