Rename UpdateColumn to ModifyColumn

This commit is contained in:
Jinzhu 2013-11-17 20:38:43 +08:00
parent c62568c089
commit 5411291173
3 changed files with 9 additions and 4 deletions

View File

@ -780,8 +780,13 @@ db.Where("email = ?", "x@example.org").Attrs(User{RegisteredIp: "111.111.111.111
```
## TODO
* Scopes, Valiations, Includes, Joins, UpdateColumn/Columns
* UpdateColumn/Columns
* Scopes
* Joins
* Scan
* AlertColumn, DropColumn, AddIndex, RemoveIndex
* Includes
* Valiations
# Author

2
do.go
View File

@ -678,7 +678,7 @@ func (s *Do) dropTable() *Do {
return s
}
func (s *Do) updateColumn(column string, typ string) {
func (s *Do) modifyColumn(column string, typ string) {
s.sql = fmt.Sprintf("ALTER TABLE %v MODIFY %v %v", s.table(), column, typ)
s.exec()
}

View File

@ -235,8 +235,8 @@ func (s *DB) AutoMigrate(value interface{}) *DB {
return s.clone().do(value).autoMigrate().db
}
func (s *DB) UpdateColumn(column string, typ string) *DB {
s.clone().do(s.data).updateColumn(column, typ)
func (s *DB) ModifyColumn(column string, typ string) *DB {
s.clone().do(s.data).modifyColumn(column, typ)
return s
}