Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

jkondrat
Copy link
Contributor

No description provided.

<column name="strength" type="varchar(255)"/>
</addColumn>
<sql>
UPDATE drug SET strength = CONCAT(dose_strength, units);
Copy link
Contributor Author

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

Copy link
Member

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

Copy link
Member

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

Copy link
Member

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

Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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());
Copy link
Member

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?

@wluyima
Copy link
Member

wluyima commented Mar 25, 2014

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already fixed this

@dkayiwa
Copy link
Member

dkayiwa commented Mar 28, 2014

Am closing this pull request because @wluyima already merged and made the followup commits.

@dkayiwa dkayiwa closed this Mar 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants