8888 <column name =" uuid" valueComputed =" uuid() " />
8989 </insert >
9090 </changeSet >
91- <changeSet id =" opensrp-atomfeed-20160719-7" author =" Vinay, Mihir" >
91+
92+ <changeSet id =" 20160119-1146" context =" setup" author =" Shashi, Hanisha" >
93+ <preConditions onFail =" MARK_RAN" >
94+ <not >
95+ <columnExists columnName =" date_created" tableName =" event_records" />
96+ </not >
97+ </preConditions >
98+ <comment >Creating column date_created for queue table. This indicates the time event was raised or created.</comment >
99+ <addColumn tableName =" event_records" >
100+ <column name =" date_created" type =" TIMESTAMP" defaultValueDate =" CURRENT_TIMESTAMP" />
101+ </addColumn >
102+ </changeSet >
103+
104+
105+ <changeSet id =" 20160603-1739" author =" angshu" >
92106 <preConditions onFail =" MARK_RAN" >
93107 <sqlCheck expectedResult =" 0" >select count(*) from chunking_history;</sqlCheck >
94108 </preConditions >
99113 </insert >
100114 </changeSet >
101115
102- <changeSet id =" opensrp-atomfeed-20160721-1" author =" maimoonak" >
103- <preConditions onFail =" MARK_RAN" >
104- <not >
105- <tableExists tableName =" event_records_extras" />
106- </not >
107- </preConditions >
108- <createTable tableName =" event_records_extras" >
109- <column name =" id" type =" int" autoIncrement =" true" >
110- <constraints nullable =" false" primaryKey =" true" />
111- </column >
112- <column name =" event_uuid" type =" varchar(40)" />
113- <column name =" uuid" type =" varchar(40)" />
114- <column name =" name" type =" varchar(255)" />
115- <column name =" value" type =" varchar(1000)" />
116- <column name =" timestamp" type =" TIMESTAMP" defaultValueDate =" CURRENT_TIMESTAMP" />
117- </createTable >
116+ <changeSet id =" 20160712-1977-1" author =" Jaswanth/Sanjit" >
117+ <preConditions onFail =" MARK_RAN" >
118+ <sqlCheck expectedResult =" 0" >
119+ SELECT COUNT(*) FROM global_property where property = 'atomfeed.publish.eventsForPatientRelationshipChange'
120+ </sqlCheck >
121+ </preConditions >
122+ <comment >Adding global property to act as switch for raising relationship events</comment >
123+ <insert tableName =" global_property" >
124+ <column name =" property" value =" atomfeed.publish.eventsForPatientRelationshipChange" />
125+ <column name =" property_value" value =" " />
126+ <column name =" uuid" valueComputed =" UUID()" />
127+ <column name =" description" value =" If set true, events related to relationship changes are published" />
128+ </insert >
118129 </changeSet >
119- <changeSet id =" opensrp-atomfeed-20170228-1" author =" maimoonak" >
120- <preConditions onFail =" MARK_RAN" >
121- <sqlCheck expectedResult =" 0" >select count(*) from role where role='opensrp-rest-service';</sqlCheck >
130+
131+ <changeSet id =" 20160712-1977-2" author =" Jaswanth/Sanjit" >
132+ <preConditions onFail =" MARK_RAN" >
133+ <sqlCheck expectedResult =" 0" >
134+ SELECT COUNT(*) FROM global_property where property = 'atomfeed.event.urlPatternForPatientRelationshipChange'
135+ </sqlCheck >
136+ </preConditions >
137+ <comment >Adding global property to specify the URL pattern for published relationship events</comment >
138+ <insert tableName =" global_property" >
139+ <column name =" property" value =" atomfeed.event.urlPatternForPatientRelationshipChange" />
140+ <column name =" property_value" value =" " />
141+ <column name =" uuid" valueComputed =" UUID()" />
142+ <column name =" description" value =" URL pattern to use for published relationship events. Default is /openmrs/ws/rest/v1/relationship/%s" />
143+ </insert >
144+ </changeSet >
145+
146+ <changeSet id =" 20160705-1120" context =" setup" author =" angshu" >
147+ <preConditions onFail =" MARK_RAN" >
148+ <not >
149+ <columnExists columnName =" tags" tableName =" event_records_queue" />
150+ </not >
122151 </preConditions >
123- <comment >Create opensrp-rest-service default role</comment >
124- <sql >
125- insert into role (role, description, uuid) values ('opensrp-rest-service', 'Default role for OpenSRP REST Service',uuid());
126- </sql >
127- </changeSet >
128- <changeSet id =" opensrp-atomfeed-20170404-1" author =" maimoonak" >
129- <preConditions onFail =" MARK_RAN" >
130- <sqlCheck expectedResult =" 0" >select count(*) from event_records where category LIKE 'opensrp%';</sqlCheck >
152+ <comment >Creating column tags for queue table. Each event can be tagged with multiple tags; as comma separated strings</comment >
153+ <addColumn tableName =" event_records_queue" >
154+ <column name =" tags" type =" varchar(255)" ></column >
155+ </addColumn >
156+ </changeSet >
157+
158+ <changeSet id =" 20160705-1130" context =" setup" author =" angshu" >
159+ <preConditions onFail =" MARK_RAN" >
160+ <not >
161+ <columnExists columnName =" tags" tableName =" event_records" />
162+ </not >
131163 </preConditions >
132- <comment >Creating feeds for existing Patient, Encounter, DrugOrder data </comment >
133- <sql >
134- INSERT INTO event_records(uuid, title, timestamp, uri, object, category, date_created)
135- SELECT UUID(), 'Patient_Migrate', NOW(), null, CONCAT('/openmrs/ws/rest/v1/patient/', pr.uuid,'?v=full'), 'OpenSRP_Patient',p.date_created
136- FROM patient p JOIN person pr ON pr.person_id=p.patient_id;
164+ <comment >Creating column tags for event_records table. Each event can be tagged with multiple tags; as comma separated strings </comment >
165+ <addColumn tableName = " event_records " >
166+ < column name = " tags " type = " varchar(255) " ></ column >
167+ </ addColumn >
168+ </ changeSet >
137169
138- INSERT INTO event_records(uuid, title, timestamp, uri, object, category, date_created)
139- SELECT UUID(), 'Encounter_Migrate', NOW(), null, CONCAT('/openmrs/ws/rest/v1/encounter/', e.uuid,'?v=full'), 'OpenSRP_Encounter',e.date_created
140- FROM encounter e;
170+ <changeSet id =" 20160713-1978-1" author =" Pankaj/Koushik" >
171+ <preConditions onFail =" MARK_RAN" >
172+ <sqlCheck expectedResult =" 0" >
173+ SELECT COUNT(*) FROM global_property where property = 'atomfeed.publish.eventsForPatientProgramStateChange'
174+ </sqlCheck >
175+ </preConditions >
176+ <comment >Adding global property to act as switch for raising program events</comment >
177+ <insert tableName =" global_property" >
178+ <column name =" property" value =" atomfeed.publish.eventsForPatientProgramStateChange" />
179+ <column name =" property_value" value =" " />
180+ <column name =" uuid" valueComputed =" UUID()" />
181+ <column name =" description" value =" If set true, events related to program changes are published" />
182+ </insert >
183+ </changeSet >
184+
185+ <changeSet id =" 20160713-1978-2" author =" Pankaj/Koushik" >
186+ <preConditions onFail =" MARK_RAN" >
187+ <sqlCheck expectedResult =" 0" >
188+ SELECT COUNT(*) FROM global_property where property = 'atomfeed.event.urlPatternForProgramStateChange'
189+ </sqlCheck >
190+ </preConditions >
191+ <comment >Adding global property to specify the URL pattern for published program events</comment >
192+ <insert tableName =" global_property" >
193+ <column name =" property" value =" atomfeed.event.urlPatternForProgramStateChange" />
194+ <column name =" property_value" value =" " />
195+ <column name =" uuid" valueComputed =" UUID()" />
196+ <column name =" description" value =" URL pattern to use for published program events. Default is /openmrs/ws/rest/v1/programenrollment/{uuid}?v=full" />
197+ </insert >
198+ </changeSet >
141199
142- INSERT INTO event_records(uuid, title, timestamp, uri, object, category, date_created)
143- SELECT UUID(), 'DrugOrder_Migrate', NOW(), null, CONCAT('/openmrs/ws/rest/v1/order/', o.uuid,'?v=full'), 'OpenSRP_DrugOrder',o.date_created
144- FROM orders o JOIN order_type ot ON o.order_type_id=ot.order_type_id WHERE ot.name IN ('drug order', 'drug_order', 'drug-order', 'drugorder');
145- </sql >
146- </changeSet >
147-
148200</databaseChangeLog >
0 commit comments