the simplest solution for fixing #15 that I could think of is using CASCADE when dropping views. Since the sync command is taking care of syncing the views in the right order, it's not a problem to use DROP VIEW CASCADE since child views that were dropped by that will be always synced again afterwards.
The dependency problem was also there for the clear_pgviews command, that's why I had to use CASCADE there as well.
The only problem I can think of for this solution is the following: if you have views in your DB which are not managed by django-pgviews but depend on another view which IS managed by django-pgviews, then it might be dropped during sync_pgviews and will definitely be dropped during clear_pgviews. I'm not sure if this is an edge case we should try to handle. I'd be happy to hear opinions on that.
the simplest solution for fixing #15 that I could think of is using
CASCADE
when dropping views. Since the sync command is taking care of syncing the views in the right order, it's not a problem to useDROP VIEW CASCADE
since child views that were dropped by that will be always synced again afterwards. The dependency problem was also there for theclear_pgviews
command, that's why I had to useCASCADE
there as well.The only problem I can think of for this solution is the following: if you have views in your DB which are not managed by
django-pgviews
but depend on another view which IS managed bydjango-pgviews
, then it might be dropped duringsync_pgviews
and will definitely be dropped duringclear_pgviews
. I'm not sure if this is an edge case we should try to handle. I'd be happy to hear opinions on that.