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

Clean improvements for Oracle pt.2 #1601

Merged
merged 11 commits into from Aug 24, 2017
Merged

Clean improvements for Oracle pt.2 #1601

merged 11 commits into from Aug 24, 2017

Conversation

@voidunit
Copy link
Contributor

@voidunit voidunit commented Apr 11, 2017

This PR is to address the rest of flaws mentioned in issue #1550. This PR continues my previous PR #1573.

The main goal of this change is to simplify OracleSchema.doClean() method and extend it with more object types. Logic of finding and dropping of objects of certain types was encapsulated into corresponding OracleSchema.ObjectType enum values.

The list of new object types that get dropped during Clean phase:

  • DIMENSION
  • INDEXTYPE
  • OPERATOR
  • CONTEXT
  • LIBRARY
  • JAVA CLASS
  • JAVA RESOURCE
  • PROGRAM
  • SCHEDULE
  • CHAIN
  • FILE WATCHER
  • EVALUATION CONTEXT
  • RULE
  • RULE SET
  • FILE GROUP
  • XML SCHEMA
  • MINING MODEL
  • REWRITE EQUIVALENCE
  • SQL TRANSLATION PROFILE

There are also object types that are intentionally ignored during Clean phase, because they contain sensitive information (passwords for external resources) and not always can be re-created via standard Flyway workflow:

  • DATABASE LINK
  • CREDENTIAL

Other ignored schema-owned types (tricky or undocumented):

  • DESTINATION
  • SCHEDULER GROUP
  • CUBE
  • CUBE DIMENSION
  • CUBE BUILD PROCESS
  • MEASURE FOLDER
  • ASSEMBLY (undocumented)
  • JAVA DATA (undocumented)

Unlike the previous implementation, which silently ignored most of unsupported types, in the new version all the ignored (non-droppable) types cause warnings in the log if found in the target schema and still can be explicitly dropped with an afterClean-callback. Even if not cleaned, they don't break migration from scratch after full cleaning - Flyway sees them during Clean phase but doesn't see them during isEmpty() check and doesn't throw an exception.

Medium tests were improved to support different Oracle environments. JUnit assumptions on Oracle version and edition were added where needed, so that some tests are automatically ignored if the target database doesn't support the tested feature. There's no need to set/unset @Ignore annotation manually any more.

This change has been successfully tested on the following Oracle versions/editions:

  • 10.2.0.1 XE
  • 10.2.0.5 SE
  • 10.2.0.5 EE
  • 11.2.0.2 XE
  • 11.2.0.4 SE
  • 11.2.0.4 EE
  • 12.1.0.2 EE (non-PDB).
@voidunit voidunit changed the title Oracle schema clean Clean improvements for Oracle pt.2 Apr 11, 2017
@axelfontaine axelfontaine added this to the Flyway 4.2.0 milestone Apr 11, 2017
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented May 18, 2017

@vosolovskiy Can you get in touch with me via email? (axel at boxfuse.com) Thanks!

Victor Osolovskiy added 2 commits Jun 4, 2017
In disableFlashbackArchiveForFbaTrackedTables() we use DBA_FLASHBACK_ARCHIVE_TABLES, which is granted to PUBLIC by default. If it is not, there may be a error even if FBA is not used.

To avoid this, USER_ view now used if DBA_ view is not accessible and the cleaned schema is current user's own schema.
Victor Osolovskiy
@voidunit voidunit mentioned this pull request Jun 4, 2017
6 of 9 tasks complete
@CLAassistant
Copy link

@CLAassistant CLAassistant commented Aug 23, 2017

CLA assistant check
All committers have signed the CLA.

@axelfontaine axelfontaine merged commit 9711533 into flyway:master Aug 24, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details
axelfontaine added a commit that referenced this pull request Aug 24, 2017
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Aug 24, 2017

@vosolovskiy Thanks. Merged!I had to disable one test for XE. As you may have noticed we have started transitioning Flyway testing to Docker containers to make it easier for contributors to have consistent dev environments. One test (scheduler112Enhancement) however does not appear to work with the Oracle XE 11.2 container we use. I assume it probably requires SE as it failed with ORA-03001: unimplemented feature, so that's how I modified it. Please correct me if I'm wrong.

axelfontaine added a commit to flyway/flywaydb.org that referenced this pull request Aug 24, 2017
@voidunit
Copy link
Contributor Author

@voidunit voidunit commented Aug 24, 2017

@axelfontaine cool, thanx!

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

Successfully merging this pull request may close these issues.

None yet

3 participants