DeleteField deletes the `field` form the `table`
(table, field string)
| 132 | |
| 133 | // DeleteField deletes the `field` form the `table` |
| 134 | func (s *Service) DeleteField(table, field string) errors.Error { |
| 135 | exists, err := s.checkField(table, field) |
| 136 | if err != nil { |
| 137 | return err |
| 138 | } |
| 139 | if !exists { |
| 140 | return nil |
| 141 | } |
| 142 | err = s.dal.DropColumns(table, field) |
| 143 | if err != nil { |
| 144 | return errors.Default.Wrap(err, "DropColumn error") |
| 145 | } |
| 146 | return s.dal.Delete(&customizeModels.CustomizedField{}, dal.Where("tb_name = ? AND column_name = ?", table, field)) |
| 147 | } |
| 148 | |
| 149 | // getCustomizedFields returns all the customized fields definitions of the table |
| 150 | func (s *Service) getCustomizedFields(table string) ([]customizeModels.CustomizedField, errors.Error) { |