forked from mirror/gorm
Add HasTable()
This commit is contained in:
parent
e6715ce175
commit
94aa843830
6
main.go
6
main.go
|
@ -346,6 +346,12 @@ func (s *DB) DropTableIfExists(value interface{}) *DB {
|
||||||
return s.clone().NewScope(value).dropTableIfExists().db
|
return s.clone().NewScope(value).dropTableIfExists().db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *DB) HasTable(value interface{}) bool {
|
||||||
|
scope := s.clone().NewScope(value)
|
||||||
|
tableName := scope.TableName()
|
||||||
|
return scope.Dialect().HasTable(scope, tableName)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *DB) AutoMigrate(values ...interface{}) *DB {
|
func (s *DB) AutoMigrate(values ...interface{}) *DB {
|
||||||
db := s.clone()
|
db := s.clone()
|
||||||
for _, value := range values {
|
for _, value := range values {
|
||||||
|
|
Loading…
Reference in New Issue