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

fix: explicitly specify the DB name when migrating #2039

Merged
merged 1 commit into from Oct 17, 2023
Merged

Conversation

motorina0
Copy link
Collaborator

@motorina0 motorina0 commented Oct 17, 2023

Summary

Each extension has a DB version stored in the dbversions table. When an extension is upgraded this version can change if there are new scripts in migration.py file.

The bug is on extension upgrade. The temp upgraded module name was used for the dbversions table:
image

The fix uses the explicit DB name.

Test Steps:

  • install an extension with a lower version (eg: satspay v0.2.3)
  • upgrade to a higher version (eg: satspay v0.2.5)

Actual Result:

  • two entries for satspay are now in the dbversions (see screenshot)

Expected Result:

  • the satspay entry gets updated to version 7
  • no new satspay entry in dbversions

Note:

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #2039 (c522554) into dev (e522a53) will decrease coverage by 0.01%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##              dev    #2039      +/-   ##
==========================================
- Coverage   61.73%   61.73%   -0.01%     
==========================================
  Files          55       55              
  Lines        8076     8075       -1     
==========================================
- Hits         4986     4985       -1     
  Misses       3090     3090              
Files Coverage Δ
lnbits/commands.py 64.28% <100.00%> (ø)
lnbits/core/helpers.py 49.05% <50.00%> (-0.95%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@jackstar12 jackstar12 left a comment

Choose a reason for hiding this comment

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

Just checked, it happened here:
https://github.com/lnbits/lnbits/pull/1940/files#diff-82afd4105ca2e11a7f9683427475878700edea7b4fb0d15321b386970e4a89d0L185-R197

The update module name broke the [-2] index, which was pretty dirty.

@dni dni merged commit d64e2f4 into dev Oct 17, 2023
23 checks passed
@dni dni deleted the fix_ext_update_db branch October 17, 2023 08:56
dni added a commit that referenced this pull request Oct 17, 2023
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.

None yet

3 participants