I have 3 tables. Locations, Units and phases.
Each location can have multiple units and each unit will have multiple phases.
Hence my database structure consists of foreign key associations as follows.
'Units.location_id' references 'Locations.id'
'Phases.unit_id' references 'Units.id'
When I delete a Location, all associated Phases of the Location and all the associated Units of each of these Phase should be deleted.
What would be the best procedure to do this ?
I am using PGSQL and PHP (CodeIgniter )