mypebble / django-pgviews

Fork of django-postgres that focuses on maintaining and improving support for Postgres SQL Views.
The Unlicense
195 stars 41 forks source link

Fixes #15 - use CASCADE for dropping views #16

Closed anneFly closed 8 years ago

anneFly commented 8 years ago

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.

scott-w commented 8 years ago

This is excellent, great work :+1:

@kennydude What do you think?

kennydude commented 8 years ago

Seems good to me :+1:

scott-w commented 8 years ago

I'll merge it now and put a build on PyPI on Monday.

anneFly commented 8 years ago

@scott-w cool, thanks