Does not work cascade swift 4

0

I have 3 entities

Places: place_id integer 16, type_place integer 16.

Images: place_id integer 16, image Binary Data.

Totals: place_id integer 16, total1 integer 16, total2 integer 16.

In places create two relationships:

images with destination Images inverse place with Delete Rule Cascade and type To Many strong> Y totals with destination Totals inverse place with Delete Rule Cascade and type To Many

In images create a relationship:

place with destination Places inverse images with Delete Rule Nulify and Type To One strong>

In totals create a relationship:

place with destination Places inverse totals with Delete Rule Nulify and Type To One strong>

When deleting from a table view, it only deletes the entity Places and does not delete images or totals.

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
        let botonBorrar = UITableViewRowAction(style: .destructive, title: "Eliminar") { (action, indexPath) in
            let contexto = self.conexion()
            let borrar = self.fetchResultController.object(at: indexPath)
            contexto.delete(borrar)

            do {
                try contexto.save()
            } catch {
                print("Ocurrio un error al borrar")
            }
        }
        return [botonBorrar]
    }

If someone has any idea why it happens, I will thank you infinitely

    
asked by Pillo 26.06.2018 в 06:17
source

0 answers