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
Rename WebsocketWorker to RemoteConsoleWorker #319
Conversation
👍 See: #320 It's fine to just remove the worker rows on upgrade to the version where you renamed the class. |
cfba091
to
0c347a4
Compare
spec/migrations/20190108135546_rename_websocket_to_remote_console_spec.rb
Show resolved
Hide resolved
cec251a
to
4221247
Compare
|
||
say_with_time("Renaming all websocket_worker related SettingsChange keys to remote_console_worker") do | ||
SettingsChange.where("key LIKE '/workers/worker_base/websocket_worker/%'").select('id, key').each do |row| | ||
SettingsChange.where(:id => row.id).update(:key => row.key.sub('websocket_worker', 'remote_console_worker')) |
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't we do this without this second where
? We already have the row. Can we remove the .select
on line 24 and perform the update on the row
?
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 yes 😆 I was thinking too much in SQL 😅
|
||
say_with_time("Renaming all websocket server role SettingsChange records to remote_console") do | ||
SettingsChange.where("key = '/server/role' AND value LIKE '%websocket%'").select('id', 'value').each do |row| | ||
SettingsChange.where(:id => row.id).update(:value => row.value.sub('websocket', 'remote_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.
Same as above
|
||
say_with_time("Renaming all remote_console_worker related SettingsChange keys to websocket_worker") do | ||
SettingsChange.where("key LIKE '/workers/worker_base/remote_console_worker/%'").select('id, key').each do |row| | ||
SettingsChange.where(:id => row.id).update(:key => row.key.sub('remote_console_worker', 'websocket_worker')) |
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.
same
|
||
say_with_time("Renaming all remote_console server role SettingsChange records to websocket") do | ||
SettingsChange.where("key = '/server/role' AND value LIKE '%remote_console%'").select('id', 'value').each do |row| | ||
SettingsChange.where(:id => row.id).update(:value => row.value.sub('remote_console', 'websocket')) |
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.
ditto
This looks like a great approach! I had a few questions above. |
4221247
to
727fa14
Compare
class SettingsChange < ActiveRecord::Base; end | ||
|
||
class ServerRole < ActiveRecord::Base | ||
self.inheritance_column = :_type_disabled |
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.
only if there is type
column on the model #4 (comment)
727fa14
to
d800f22
Compare
d800f22
to
971f43d
Compare
Checked commit skateman@971f43d with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.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.
This looks good to me. I hope we got them all. 🤞
🎉 🏃 |
Renaming both the role and the worker, dropping old workers from the DB.
Parent issue: ManageIQ/manageiq#18300
Core PR: ManageIQ/manageiq#18337
@miq-bot add_label hammer/no