-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Notifications field added while creating users with omniauth #3158
Conversation
Generated by 🚫 Danger |
0bea481
to
23fb2de
Compare
oh no, oops! So, we actually have to add a reversed migration, rather than
rolling back, now that it's in the commit history. Can you open a PR with
undoing the previous change and adding the new one?
…On Tue, Jul 31, 2018 at 8:48 AM Sidharth Bansal ***@***.***> wrote:
@jywarren <https://github.com/jywarren> we migrated users instead of
rusers in #3098 <#3098>. Can you
please rollback the db for changes of #3098
<#3098> before merging this one?
Sorry for the inconvenience.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3158 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJyA6PHkxLdfg3rpWQAGY_kOovgR3ks5uMFIQgaJpZM4ViRmd>
.
|
Hi @jywarren I have added the migration for removal of password_checker field in this pr. Can you please review it? |
I think we are getting octokit error again. Maybe it is due to change of key as it happened earlier |
Can we please ignore codeclimate errors? They are for deeply nested if-else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple small changes! Thanks!!!!
@@ -0,0 +1,5 @@ | |||
class AddPasswordCheckerToRusers < ActiveRecord::Migration[5.2] | |||
def change | |||
add_column :rusers, :password_checker, :integer, default: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could actually be in the same migration!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I could not understand what I need to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two migrations. First is to delete password_checker from Users.
Second is to add password_checker to RUsers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh just that you can perform both steps in the same migration file. They needn't be separated... Although it's not a big deal, over the lifetime of the project I think we should try not to have too many migration files. Mind changing this? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for explanation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add link to the code for example? I tried a lot searching on net and on plots2 migration files. We can have different dbms queries on same table in single migration. But I could not find a migration with two different tables involved. In this pr, we are involved with two tables Rusers(removal of password checker) & Users(addition of password checker).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it'll work to do:
def change
remove_column :users, :password_checker, :integer
add_column :rusers, :password_checker, :integer, default: 0
end
I don't have an example but have you tried it? I think the table name is just specified in the one line, no? But honestly it's not a big deal, just a slight preference, so if you find that it doesn't work, 2 files is fine!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot. I was thinking other type of solution which was giving errors.
Thanks it worked.
u = User.find_by(username: username) | ||
if u && u.password_checker != 0 | ||
n = u.password_checker | ||
hash = { 1 => "Facebook", 2 => "Github", 3 => "Google", 4 => "Twitter" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use the style 1: "Facebook"
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi I tried but it is giving syntax error. I know that we should use colons instead of hash rockets. But this is not working here. I guess, we use colons when we use symbols --> value.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't make integers as symbols as at another place I am using the reverse hash. In reverse hash I am mapping providers with integer values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok! thanks for trying!
Also where could we helpfully explain the usage of password checker? |
I have sent the documentation. |
57dadcb
to
44ada75
Compare
b76ebf7
to
38e0d09
Compare
@jywarren can you please review this? |
This looks good - are you confident that we should merge? Thanks! |
Yes |
…ab#3158) * Notifications field added in users * Rails migration rollback and new migration added * Migrations corrected * Added documentation * Two migrations merged into one
…ab#3158) * Notifications field added in users * Rails migration rollback and new migration added * Migrations corrected * Added documentation * Two migrations merged into one
Closes #3032
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
fixes #0000
-style reference to original issue #@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays.
Thanks!