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-4135 Modify DrugOrder.frequency and TRUNK-4052 Add a way to test liquibase changesets #511

Closed
wants to merge 4 commits into from

Conversation

rkorytkowski
Copy link
Member

Once I added a way to test liquibase upgrade I discovered many of new changesets had bugs, which I fixed as well. Please review, but do not merge yet, as I need to add some assertions in my test to be 100% sure everything worked as expected.

insertStatement.setString(10, discontinuedOrder.discontinuedReasonNonCoded);
insertStatement.setString(11, UUID.randomUUID().toString());
insertStatement.setString(12, "DISCONTINUE");
Copy link
Member Author

Choose a reason for hiding this comment

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

Probably I should store and get it from discontinueOrder object, right?

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean?

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean this is a required field that cannot be null. I assumed it is always DISCONTINUE here, but I may as well copy the value from the existing discontinuedOrder.

Copy link
Member

Choose a reason for hiding this comment

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

This changeset is creating DC orders meaning the action is DISCONTINUE as you are doing

@wluyima
Copy link
Member

wluyima commented Jan 9, 2014

You missed something, you need to set the order_frequency for existing drug orders

@@ -6805,5 +6806,50 @@
<comment>Removing discontinued_by from orders</comment>
<dropColumn tableName="orders" columnName="discontinued_by" />
</changeSet>

<changeSet id="201401031432-TRUNK-4135" author="rkorytkowski">
<preConditions onFail="MARK_RAN">
Copy link
Member

Choose a reason for hiding this comment

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

comment?

@wluyima
Copy link
Member

wluyima commented Jan 9, 2014

Never mind, i have seen the code that sets the drug_order.frequency


@Test
public void shouldUpgradeFromClean1_9To1_10() throws IOException, SQLException {
upgradeTestUtil.upgrade();
Copy link
Member

Choose a reason for hiding this comment

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

This has no assertions?

@wluyima
Copy link
Member

wluyima commented Jan 10, 2014

I seem to like the way you modeled the upgrade tests against a database instance

<column name="care_setting" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="care_setting" type="varchar(50)" />
Copy link
Member Author

Choose a reason for hiding this comment

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

@wluyima you said to remove defaultValue and that you fixed the problem by adding not nullable constraint in some later changeset, but I see that you haven't removed nullable="false" here...

Copy link
Member

Choose a reason for hiding this comment

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

See the changeset with id 201312271826-TRUNK-4156 that adds orders.care_setting?

@rkorytkowski
Copy link
Member Author

I think it's ready for merging. I have fixed some new 1.10.x changesets, but I didn't add new checksums for them so devs will need to cleanup their dbs.

<not>
<sqlCheck expectedResult="0">
SELECT * FROM orders WHERE care_setting IS NULL
SELECT count(*) FROM orders WHERE care_setting IS NULL
Copy link
Member Author

Choose a reason for hiding this comment

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

I needed to fix this changeset as well.

Copy link
Member

Choose a reason for hiding this comment

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

Pull the latest changes, that was fixed in github this morning

@@ -45,19 +46,22 @@ private void createDiscontinueOrders(JdbcConnection connection, List<Discontinue
connection.setAutoCommit(false);
insertStatement = connection
.prepareStatement("Insert into orders(previous_order_id, concept_id, patient_id, encounter_id, "
Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't assign order_number, which also seems like a bug...

Copy link
Member

Choose a reason for hiding this comment

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

Good catch! I wonder why it doesn't fail

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't fail, because order_number is nullable right now... We're missing a changeset, which makes it not nullable.

Copy link
Member

Choose a reason for hiding this comment

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

see 201311041514-TRUNK-4122

@wluyima
Copy link
Member

wluyima commented Jan 14, 2014

Merged the code at c5533f3

@wluyima wluyima closed this Jan 14, 2014
RandilaP pushed a commit to RandilaP/openmrs-core that referenced this pull request Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants