DropTable drop table for values
(values ...interface{})
| 318 | |
| 319 | // DropTable drop table for values |
| 320 | func (m Migrator) DropTable(values ...interface{}) error { |
| 321 | values = m.ReorderModels(values, false) |
| 322 | for i := len(values) - 1; i >= 0; i-- { |
| 323 | tx := m.DB.Session(&gorm.Session{}) |
| 324 | if err := m.RunWithValue(values[i], func(stmt *gorm.Statement) error { |
| 325 | return tx.Exec("DROP TABLE IF EXISTS ?", m.CurrentTable(stmt)).Error |
| 326 | }); err != nil { |
| 327 | return err |
| 328 | } |
| 329 | } |
| 330 | return nil |
| 331 | } |
| 332 | |
| 333 | // HasTable returns table exists or not for value, value could be a struct or string |
| 334 | func (m Migrator) HasTable(value interface{}) bool { |
nothing calls this directly
no test coverage detected