-
Notifications
You must be signed in to change notification settings - Fork 125
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
Migrate MiddlewareServer to MiddlewareServerWildfly and MiddlewareServerEap #81
Conversation
@@ -0,0 +1,33 @@ | |||
class MigrateMiddlewareServerToWildflyAndEap < ActiveRecord::Migration[5.0] | |||
class MiddlewareServer < ApplicationRecord |
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.
Be sure to add self.inheritance_column = :_type_disabled
for this stub.
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.
Specs are required for data migrations.
@@ -0,0 +1,33 @@ | |||
class MigrateMiddlewareServerToWildflyAndEap < ActiveRecord::Migration[5.0] | |||
class MiddlewareServer < ApplicationRecord |
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.
class MiddlewareServer < ActiveRecord::Base
see details:
#4
Checked commits tumido/manageiq-schema@47df2bc~...3f7ce44 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 db/migrate/20170928202851_migrate_middleware_server_to_wildfly_and_eap.rb
|
Just want approval from @abonas here and on the dependent PR before merging. |
Thanks @Fryguy 👍 :) |
@cfcosta please review. |
say_with_time('Migrating middleware_server to middleware_server_wildfly') do | ||
MiddlewareServer | ||
.where("type = ? AND product ~* ?", 'ManageIQ::Providers::Hawkular::MiddlewareManager::MiddlewareServer', 'wildfly') | ||
.update_all(:type => 'ManageIQ::Providers::Hawkular::MiddlewareManager::MiddlewareServerWildfly') |
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.
shouldn't the new wildfly/eap class be a subclass/subtype of middleware server class? here it seems it's in hierarchy of middleware_manager, or I am probably missing something
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 think they are better included in middleware_manager as well, so that we have proper namespacing for the resources, what do you think?
Another option would be ManageIQ::Providers::Hawkular::WildFlyServer
. Any of the two are fine by me.
@cfcosta please review |
approved |
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.
LGTM
|
||
migration_context :down do | ||
it "reverts type for WildFly" do | ||
mw_server = mw_server_stub.create!(:type => "ManageIQ::Providers::Hawkular::MiddlewareManager::MiddlewareServerWildfly") |
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.
Both local assignments should be extracted to let
, and the migration to be run in a before
filter.
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 point me to an example? I can't find any other migration which would be using it... Or maybe I just don't understand the suggestion.
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.
@cfcosta, does it make any difference here to move two assignments from test cases into two let
s?
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.
Just checked on other migration tests, it seems like all of them are done the way you did them, so 🚢 it.
@Fryguy @chessbyte lets get this in b4 the feature ❄️ |
Sub-classing MiddlewareServer into more specific classes for Wildfly and EAP
Related to: ManageIQ/manageiq-providers-hawkular#60
Resolves: https://issues.jboss.org/browse/HAWKULAR-1248