-
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
bio field now part of User; status moved off of DrupalUser #1497
Changes from 15 commits
4014dfc
44011ae
b849133
7092a8a
eb697c6
d47eae8
7180299
21bca11
d943b4c
49f939a
dc19d1b
a97c134
5bc7cab
dab6503
19e2c16
29b9f35
04ea0eb
d863e57
237e5d1
61ce717
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class AddUserBioAndToken < ActiveRecord::Migration | ||
def up | ||
add_column :rusers, :bio, :text, limit: 2147483647, default: '' | ||
add_column :rusers, :token, :string | ||
add_column :rusers, :status, :integer, default: 0 | ||
remove_column :rusers, :location_privacy | ||
|
||
# copy bios into new fields for non-spam users | ||
DrupalUsers.where('status != 0').each do |u| | ||
user = u.user | ||
user.status = u.status | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right here you could do something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jywarren okay, I am setting up plots2 again and will do this hopefully by today. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jywarren I don't think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to regenerate the schema file. Doing this now! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jywarren great. |
||
user.bio = DrupalProfileValue.find_by_uid(user.id, conditions: { fid: 7 }) || '' | ||
user.token = SecureRandom.uuid | ||
user.save({}) | ||
end | ||
drop_table :location_tags | ||
drop_table :searches | ||
end | ||
|
||
def down | ||
remove_column :rusers, :bio | ||
remove_column :rusers, :token | ||
remove_column :rusers, :status | ||
add_column :rusers, :location_privacy, :boolean | ||
end | ||
end |
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.
it's odd; the error I'm seeing is:
that's on this line:
And
@profile_user
is aUser
as of this line: https://github.com/jywarren/plots2/blob/user-bio-and-token/app/controllers/users_controller.rb#L107So, given this default, it should have a value of '', not
nil
. What's the deal?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'm adding a unit test to ensure that a new
User
record has a non-nilbio
.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.
@jywarren I'll try to look into 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.
Oh, okay. Yes, in the migration we set the default bio to
''
, right?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.
yes, that's what's confusing!
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.
Apparently default values are not universally supported??? whoa. I'll try setting it manually.
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.
Using
rails console
?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.
@jywarren Oh, the fixtures weren't updated?
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.
ugh yeah. i should've done this all at once, locally, but i kept thinking it was a small fix.
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.
@jywarren I'm glad we have this sorted. What next for this PR?