Add nGrinder DB version model and save it in DB because there is subtab <preConditions>in <changeSet> . it can be used to confirm which <changeSet> is to exec. e.g there is only one item in version table id,version 1 3.0 log file content is as follow this is nGrinder 3.1 DB changes <changeSet id="1" author="ngrinder"> <preConditions onFail="MARK_RAN"> <sqlCheck expectedResult="1">SELECT COUNT(1) from ngrinder_version WHERE test1<=3.1</sqlCheck> </preConditions> .......... </changeSet> this is nGrinder 3.3 DB changes <changeSet id="2" author="ngrinder"> <preConditions onFail="MARK_RAN"> <sqlCheck expectedResult="1">SELECT COUNT(1) from ngrinder_version WHERE test1<=3.3</sqlCheck> </preConditions> .......... </changeSet> if user has already used nGrinder version 3.0 , Both <changeSet id="1"> and <changeSet id="2"> will be exec when user update nGrinder and restarted. |
Administrator
|
Good to hear it. Could you make the change set for current nGrinder 3.0? -----Original Message----- If you reply to this email, your message will be added to the discussion below:
http://ngrinder.642.n7.nabble.com/Update-rules-about-DB-change-tp20.html
To start a new topic under ngrinder_dev, email [hidden email]
To unsubscribe from ngrinder_dev, click here. NAML |
In reply to this post by Matt
Add create table sql at logfile.xml, if there is no version table in DB,it will be created. <changeSet author="ngrinder_ver" id="1" > <preConditions onFail="MARK_RAN"> <not> <tableExists tableName="ngrinder_version"/> </not> </preConditions> <createTable tableName="ngrinder_version"> <column name="id" type="bigint"> <constraints primaryKey="true" nullable="false"/> </column> <column name="version" type="double" /> </createTable> <insert tableName="ngrinder_version"> <column name="id" valueNumeric="1"/> <column name="version" valueNumeric="3.0"/> </insert> </changeSet> this vesion number will be increased along with nGrinder DB changes e.g based on this condition,liquibase will decide this whether be exec <preConditions onFail="MARK_RAN"> <sqlCheck expectedResult="1">SELECT COUNT(1) from ngrinder_version WHERE ver<=3.1</sqlCheck> </preConditions> and then DB version also will be updated <update tableName="ngrinder_version"> <column name="version" value="3.1"/> <where>id=1</where> </update> All ngrinder_version table C R U D will be in changelog.xml and it will not be operated on codes leve. |
Free forum by Nabble | Edit this page |