Skip to content

Create a migration function for datasource to add migrationVersion field#6025

Merged
kavilla merged 1 commit intoopensearch-project:mainfrom
yibow98:add-datasource-migrationVersion
Mar 5, 2024
Merged

Create a migration function for datasource to add migrationVersion field#6025
kavilla merged 1 commit intoopensearch-project:mainfrom
yibow98:add-datasource-migrationVersion

Conversation

@yibow98
Copy link
Copy Markdown
Contributor

@yibow98 yibow98 commented Mar 5, 2024

Description

This PR is to add a migration function with version 2.4.0 for datasource to add a migrationVersion field.
For more information, please refer to the RFC: #6022

Issues Resolved

#6022

Testing the changes

For the testing, it is included in this RFC: #6022

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.13%. Comparing base (bb8155a) to head (548546b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6025      +/-   ##
==========================================
- Coverage   67.13%   67.13%   -0.01%     
==========================================
  Files        3317     3318       +1     
  Lines       64016    64021       +5     
  Branches    10256    10256              
==========================================
+ Hits        42979    42981       +2     
- Misses      18545    18548       +3     
  Partials     2492     2492              
Flag Coverage Δ
Linux_1 31.63% <ø> (ø)
Linux_2 55.20% <ø> (ø)
Linux_3 44.58% <100.00%> (-0.01%) ⬇️
Linux_4 35.16% <ø> (ø)
Windows_1 31.65% <ø> (ø)
Windows_2 55.17% <ø> (ø)
Windows_3 44.60% <100.00%> (-0.01%) ⬇️
Windows_4 35.16% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seraphjiang
Copy link
Copy Markdown
Member

Thanks @yibow98 should we remove dummy from title. it add migration method and set the default value to 2.4.0. not truly dummy

@yibow98 yibow98 changed the title Create a dummy migration function for datasource to add migrationVersion field Create a migration function for datasource to add migrationVersion field Mar 5, 2024
@yibow98
Copy link
Copy Markdown
Contributor Author

yibow98 commented Mar 5, 2024

Thanks @yibow98 should we remove dummy from title. it add migration method and set the default value to 2.4.0. not truly dummy

Done

Comment thread src/plugins/data_source/server/saved_objects/data_source.ts Outdated
Comment thread CHANGELOG.md Outdated
Copy link
Copy Markdown
Member

@seraphjiang seraphjiang left a comment

Choose a reason for hiding this comment

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

remove dummy from code

Comment thread src/plugins/data_source/server/saved_objects/data_source.ts Outdated
Copy link
Copy Markdown
Member

@seraphjiang seraphjiang left a comment

Choose a reason for hiding this comment

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

if we use '2.4.0', how could we differentiate the MDS data saved before 2.13.0 . Otherwise lgtm

Comment thread src/plugins/data_source/server/saved_objects/data_source.ts
@yibow98
Copy link
Copy Markdown
Contributor Author

yibow98 commented Mar 5, 2024

if we use '2.4.0', how could we differentiate the MDS data saved before 2.13.0 . Otherwise lgtm

The migrationVersion is the version that the saved object apply the latest migration. If there is not data schema change, then all datasource should have the migrationVersion of 2.4.0 until we have a new migration function.

@yibow98 yibow98 force-pushed the add-datasource-migrationVersion branch from 35eefe8 to 3779498 Compare March 5, 2024 21:10
@yibow98 yibow98 force-pushed the add-datasource-migrationVersion branch from 3779498 to 548546b Compare March 5, 2024 22:15
@kavilla kavilla merged commit 70adcc9 into opensearch-project:main Mar 5, 2024
@kavilla
Copy link
Copy Markdown
Member

kavilla commented Mar 5, 2024

Makes sense. Might need to fix at the root if you ever need to add multiple migrations.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 5, 2024
…eld (#6025)

This PR is to add a migration function with version 2.4.0 for datasource to add a migrationVersion field.
For more information, please refer to the RFC: #6022

Issues Resolved
#6022

Signed-off-by: Yibo Wang <yibow@amazon.com>
(cherry picked from commit 70adcc9)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants