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

NOISSUE - Fix Error In Users Migration #1682

Merged
merged 2 commits into from
Dec 29, 2022

Conversation

rodneyosodo
Copy link
Member

@rodneyosodo rodneyosodo commented Dec 12, 2022

Signed-off-by: 0x6f736f646f b1ackd0t@protonmail.com

What does this do?

Create a user status field only if it has not been created in the database.

Which issue(s) does this PR fix/relate to?

There is no such issue.

List any changes that modify/break current functionality

N/A

Have you included tests for your changes?

No

Did you document any new/modified functionality?

No

Notes

credit @arvindh123

Signed-off-by: 0x6f736f646f <b1ackd0t@protonmail.com>
@rodneyosodo rodneyosodo requested a review from a team as a code owner December 12, 2022 13:12
@arvindh123
Copy link
Contributor

arvindh123 commented Dec 14, 2022

@0x6f736f646f ,
This PR will not solves the issue #1661 ,This PR will fix if there already datatype exisits

To replicate the issue #1661
Running Mainflux latest version with db in docker or standalone,
Then downgrade the Mainflux version to v0.12 without clearing the users service DB in docker volume or standalone Postgres database ,

The problem in the issue #1661,
If we use the same latest mainflux users docker db volume or standalone postgres database
in downgrade version like v0.12, In v0.12 there is no user_5 migrations, So migrate library throw error if there is any unknown migration in database.

Fix
To Ignore unknown migration add the line migrate.SetIgnoreUnknown(true) at https://github.com/mainflux/mainflux/blob/master/users/postgres/init.go#L91 will solve the error in issue #1661 .

@codecov-commenter
Copy link

Codecov Report

Merging #1682 (b5d43ab) into master (57e3c25) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1682      +/-   ##
==========================================
+ Coverage   70.28%   70.29%   +0.01%     
==========================================
  Files         148      148              
  Lines       11503    11508       +5     
==========================================
+ Hits         8085     8090       +5     
  Misses       2754     2754              
  Partials      664      664              
Impacted Files Coverage Δ
users/postgres/init.go 92.59% <100.00%> (+0.75%) ⬆️

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

Copy link
Contributor

@manuio manuio left a comment

Choose a reason for hiding this comment

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

LGTM

@dborovcanin dborovcanin changed the title MF-1661 - Fix Error In Users Migration NOISSUE - Fix Error In Users Migration Dec 29, 2022
@dborovcanin dborovcanin merged commit 6f2ce82 into absmach:master Dec 29, 2022
@rodneyosodo rodneyosodo deleted the fixuserstatus branch October 22, 2024 08:00
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.

5 participants