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-3638 Separate liquibase file into separate files per version #1841
Conversation
@WolfSchlegel, thanks for your PR! By analyzing the annotation information on this pull request, we identified @bmamlin, @wluyima and @suniala to be potential reviewers |
@WolfSchlegel since you opened this new pull request, should we close the other one? #1804 |
Yes, this pull request supersedes #1804. |
@WolfSchlegel because all the 2.1 changes, so far, are also in 2.0, you are correct to say that for now, liquibase-update-2.1.xml will be empty. So yes none is moving out of liquibase-update-to-latest.xml I also somehow think that we need to do something about liquibase-schema-only.xml along the same lines as we are doing for liquibase-update-to-latest.xml |
@@ -58,7 +58,7 @@ | |||
/** | |||
* This class uses Liquibase to update the database. <br> | |||
* <br> | |||
* See /metadata/model/liquibase-update-to-latest.xml for the changes. This class will also run | |||
* See /metadata/model/liquibase-master.xml for the changes. This class will also run |
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.
The folder containing this is no longer metadata/model :)
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.
Done.
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd | ||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"> | ||
|
||
<include file="liquibase-update-2.1.xml"/> |
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 this order be reversed? What is the order of execution of the files listed here?
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.
Quite right, given that the liquibase-update-2.1.xml file is currently empty. I renamed the files to
- liquibase-update-baseline.xml - contains the historic baseline
- liquibase-update-to-latest.xml - starts as an empty file. At some point in time you would close the baseline and add any changes either to this file or to another file referring to a particular version.
Please let me know if that makes sense.
a799656
to
29882a5
Compare
Regarding liquibase-schema-only.xml, please let me know your requirements. Would it be the same exercise, i.e. introduce a master file that includes multiple files? |
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
|
||
This Source Code Form is subject to the terms of the Mozilla Public License, |
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.
Is this file name correct? :)
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.
It depends, please have a look at my other comment on renaming files.
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.
@WolfSchlegel i looked at the comments but i still do not yet understand the need to have "update" twice in the file name. :)
@@ -68,7 +68,7 @@ | |||
|
|||
private static final Log log = LogFactory.getLog(DatabaseUpdater.class); | |||
|
|||
private static final String CHANGE_LOG_FILE = "liquibase-update-to-latest.xml"; | |||
private static final String CHANGE_LOG_FILE = "liquibase-master.xml"; |
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.
Since this is really still an update file, it would be nice for it to contain the word update,
how about liquibase-update-to-latest-master.xml
? I'll update the ticket
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 have updated the ticket description, we don't need to rename the liquibase-update-to-lastest.xml
fie
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"> | ||
|
||
<include file="liquibase-update-baseline.xml"/> | ||
<include file="liquibase-update-to-latest.xml"/> |
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.
Thought this was renamed
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd | ||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"> | ||
|
||
<include file="liquibase-update-baseline.xml"/> |
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.
If we're doing this in 2.1, this should be probably named liquibase-update-2.0.xml
@WolfSchlegel did you pull the latest upstream changes before making another commit for this? :) |
…to liquibase-update-2.1.xml
111d8a7
to
a34a020
Compare
|
@WolfSchlegel i tried testing your changes by doing a fresh openmrs setup but got the error message below: There was an error while updating the database to the latest. file: liquibase-update-to-latest.xml. Error: Migration failed for change set liquibase-update-to-2.0.xml::20090225-1551::dthomas: Reason: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE Does it work on your side? |
Since your changes look obviously correct, i tried to look into the cause of this failure. I discovered that the changeset id is inserted in liquibase-schema-only.sql and hence is supposed to be marked as run. This was not the case and i found out that it's because liquibase does not use the changeset id alone to skip a changeset, but also the name of the file in which the changeset belongs. So this https://github.com/openmrs/openmrs-core/blob/master/api/src/main/resources/liquibase-schema-only.xml#L3455 needs to be changed to the name of the file where the changeset currently resides, and that is, liquibase-update-to-2.0.xml |
Description
This pull request implements most of your feedback on #1804.
The following feedback still needs to be resolved:
"To me it seems that all those changes happened in 2.0 and not 2.1. It's what the pull request title suggests (I may be wrong here so please reassure me). Since 2.0 has been released in beta already we cannot move those changesets out of liquibase-update-to-latest.xml. This file should really contain only changesets introduced in 2.1 (probably none at the moment). ... Actually let me answer myself. They happened in 1.12.x and have been released in 1.12.0. It means we cannot move them out of liquibase-update-to-latest.xml and this file should be empty initially."
Could you please provide some guidance which changes to put into which liquibase files?
Related Issue
see https://issues.openmrs.org/browse/TRUNK-3638
Checklist:
git pull --rebase upstream master
.mvn clean package
right before creating this pull request andadded all formatting changes to my commit.
…to liquibase-update-2.1.xml