// PurgeOrphanCountries removes countries without any photos.
funcPurgeOrphanCountries()error{
entity.FlushCountryCache()
switchDbDialect(){
default:
returnUnscopedDb().Exec(`DELETE FROM countries WHERE country_slug <> ? AND id NOT IN (SELECT photo_country FROM photos)`,entity.UnknownCountry.CountrySlug).Error
}
}
// PurgeOrphanCameras removes cameras without any photos.
funcPurgeOrphanCameras()error{
entity.FlushCameraCache()
switchDbDialect(){
default:
returnUnscopedDb().Exec(`DELETE FROM cameras WHERE camera_slug <> ? AND id NOT IN (SELECT camera_id FROM photos)`,entity.UnknownCamera.CameraSlug).Error
}
}
// PurgeOrphanLenses removes cameras without any photos.
funcPurgeOrphanLenses()error{
entity.FlushLensCache()
switchDbDialect(){
default:
returnUnscopedDb().Exec(`DELETE FROM lenses WHERE lens_slug <> ? AND id NOT IN (SELECT lens_id FROM photos)`,entity.UnknownLens.LensSlug).Error