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

feature: introduce flyway as per #1059 #1828

Merged
merged 2 commits into from
Dec 31, 2018
Merged

feature: introduce flyway as per #1059 #1828

merged 2 commits into from
Dec 31, 2018

Conversation

kezhenxu94
Copy link
Member

@kezhenxu94 kezhenxu94 commented Dec 30, 2018

Hi @nobodyiam I open this PR as per #1059 , and here is what would change in the future when we update database schemas and how users upgrade it:

  1. Users run mvn -N -Pconfigdb flyway:migrate and mvn -N -Pportaldb flyway:migrate to initialize(or upgrade if needed) the database schema ApolloConfigDB and ApolloPortalDB respectively.

Users can modify the database config in scripts/db/migration/flyway-configdb.properties and scripts/db/migration/flyway-portaldb.properties

  1. If we want to modify the schema, say ApolloConfigDB, add a new sql script file with versions on it, like V1.1.0__make_awesome_modification.sql under the directory scripts/db/migration/configdb/, e.g. scripts/db/migration/configdb/V1.1.0__make_awesome_modification.sql

  2. Users pull the new files and re-run mvn -N -Pconfigdb flyway:migrate and mvn -N -Pportaldb flyway:migrate, all changes will be reflected on the database.

If any further changes should be done, please let me know.

Regards.

@codecov-io
Copy link

codecov-io commented Dec 30, 2018

Codecov Report

Merging #1828 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1828      +/-   ##
============================================
- Coverage     48.33%   48.31%   -0.02%     
+ Complexity     1915     1913       -2     
============================================
  Files           394      394              
  Lines         11680    11680              
  Branches       1225     1225              
============================================
- Hits           5645     5643       -2     
  Misses         5589     5589              
- Partials        446      448       +2
Impacted Files Coverage Δ Complexity Δ
...ervice/service/ReleaseMessageServiceWithCache.java 85.71% <0%> (-1.2%) 24% <0%> (-1%)
.../apollo/internals/RemoteConfigLongPollService.java 77.3% <0%> (-0.62%) 27% <0%> (-1%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0ab20b0...282ca41. Read the comment docs.

@coveralls
Copy link

coveralls commented Dec 30, 2018

Coverage Status

Coverage remained the same at 52.14% when pulling 65b5031 on kezhenxu94:feature/flyway-migration into 34b912c on ctripcorp:master.

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! However I think the flyway.locations values should be corrected, as it doesn't work in my local environment.

Besides, we should also keep those legacy scripts/sql/delta sql files, since they are useful for old versions of apollo.

scripts/db/migration/flyway-configdb.properties Outdated Show resolved Hide resolved
scripts/db/migration/flyway-portaldb.properties Outdated Show resolved Hide resolved
@kezhenxu94
Copy link
Member Author

@nobodyiam thanks for reviewing, I have committed changes as requested.

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nobodyiam nobodyiam merged commit 6d323eb into apolloconfig:master Dec 31, 2018
@kezhenxu94 kezhenxu94 deleted the feature/flyway-migration branch December 31, 2018 14:47
CrackerCat pushed a commit to CrackerCat/apollo-1 that referenced this pull request Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants