-
Notifications
You must be signed in to change notification settings - Fork 3.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
TRUNK-4265 Add strength field to Drug #793
Conversation
<column name="strength" type="varchar(255)"/> | ||
</addColumn> | ||
<sql> | ||
UPDATE drug SET strength = CONCAT(dose_strength, units); |
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.
@wluyima
I'm not sure how to approach this. The mergeColumns (http://www.liquibase.org/documentation/changes/merge_columns.html) also drops the old ones
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.
Use the modifySql tag to have varying sql for supported DBs i.e. mysql, oracle, postgresql, sqlserver, db2, if the unit test fail, you might want to include one for h2 to make it pass
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.
One of the preconditions for the changeset that sets the values should check that they have rows with a doseStrength value but no units
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 try using mergeColumns and see how that works
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.
And it fine to drop the columns, i have updated the ticket description that the old columns need to be dropped, so if mergeColumns does that, then it is absolutely 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.
@wluyima
After dropping the columns drug list throws an exception (Unknown column 'this_.dose_strength' in 'field list') and removing them from hibernate causes multiple tests to fail
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.
Did you update Order.hbm file and when do you get Unknown column 'this_.dose_strength' in 'field list'? Is it when running a query, if yes, it is because you have not yet update the hbm file
Assert.assertThat(drugs.size(), Matchers.is(3)); | ||
Assert.assertTrue(drugs.get(0).containsValue("1.0tab(s)")); | ||
Assert.assertTrue(drugs.get(1).containsValue("325.0mg")); | ||
Assert.assertTrue(drugs.get(2).get("strength").isEmpty()); |
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.
Would be best to have this as null?
Looks good, i will address the comments as i merge the code. |
@@ -7288,7 +7288,7 @@ | |||
<not> | |||
<sqlCheck expectedResult="0"> | |||
SELECT COUNT(o.order_id) FROM orders o | |||
WHERE o.order_id IN (SELECT to.order_id FROM test_order to) | |||
WHERE o.order_id IN (SELECT torder.order_id FROM test_order torder) |
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 already fixed this
Am closing this pull request because @wluyima already merged and made the followup commits. |
No description provided.