Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly drop Views then doing a Flyway.clean() on a PostgreSQL db #918

Closed
gergelyszakacs opened this issue Jan 7, 2015 · 6 comments
Closed

Comments

@gergelyszakacs
Copy link

@gergelyszakacs gergelyszakacs commented Jan 7, 2015

Database Views are not dropped when a Flyway.clean() is issued. If the migration scripts baseline the database with some existing tables that cannot be touched and just adds some Views (probably in a different schema than the tables themselves) then the clean() call will leave those Views in place. So a new feature is needed that explicitly drops these Views.

gergelyszakacs pushed a commit to gergelyszakacs/flyway that referenced this issue Jan 7, 2015
Change-Id: I40251a9463805ca56add8c0295806dcf2d0a9780
gergelyszakacs pushed a commit to gergelyszakacs/flyway that referenced this issue Jan 7, 2015
Change-Id: I40251a9463805ca56add8c0295806dcf2d0a9780
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 8, 2015

I am trying to understand your exact scenario.

DB with existing Schema A with table A1
Flyway.schemas set to B
Flyway creates schema B and a migration adds a view B1 that maps to A.A1
Flyway.clean (schema B only) does not drop B1

Is this correct?

@gergelyszakacs
Copy link
Author

@gergelyszakacs gergelyszakacs commented Jan 8, 2015

Hi Axel,

Thanks for getting back to me so soon. Yes, this is my scenario.

Gergő

On Thu, Jan 8, 2015 at 5:58 AM, Axel Fontaine notifications@github.com
wrote:

I am trying to understand your exact scenario.

DB with existing Schema A with table A1
Flyway.schemas set to B
Flyway creates schema B and a migration adds a view B1 that maps to A.A1
Flyway.clean (schema B only) does not drop B1

Is this correct?


Reply to this email directly or view it on GitHub
#918 (comment).

@logicbomb
Copy link

@logicbomb logicbomb commented Feb 21, 2015

👍 the fix as implemented by @gergelyszakacs resolves the issue

axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Mar 5, 2015
jmahonin pushed a commit to jmahonin/flyway that referenced this issue Jul 15, 2015
@teicher
Copy link

@teicher teicher commented Nov 12, 2015

Hi Axel, looks to me like this will not work for materiaized views. (need to call DROP MATERIALIZED VIEW ...)
Cheers, Tom.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Nov 12, 2015

@teicher Please file a new issue and include a script that Flyway fails to clean.

@teicher
Copy link

@teicher teicher commented Nov 12, 2015

Okay, so the dependency between views (and materialized ones) is the problem:
#1129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants