62b93b9f85474d7da5b846f170f96b8f54a69cd2
[cps/cps-temporal.git] / src / main / resources / db / changelog / schema / 04-added-operation-field-in-network-data.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3   ============LICENSE_START=======================================================
4   Copyright (c) 2021 Bell Canada.
5   ================================================================================
6   Licensed under the Apache License, Version 2.0 (the "License");
7   you may not use this file except in compliance with the License.
8   You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12   Unless required by applicable law or agreed to in writing, software
13   distributed under the License is distributed on an "AS IS" BASIS,
14   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   See the License for the specific language governing permissions and
16   limitations under the License.
17
18   SPDX-License-Identifier: Apache-2.0
19   ============LICENSE_END=========================================================
20 -->
21
22 <databaseChangeLog
23         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24         xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
25         xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
26             http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
27
28     <changeSet id="4.1" author="cps">
29         <comment>Add operation field in network data timescale table
30             and set default 'UPDATE' value for existing data
31         </comment>
32         <addColumn tableName="network_data">
33             <column name="operation" type="VARCHAR(20)"
34                     remarks="Field to store the operation type">
35             </column>
36         </addColumn>
37         <update tableName="network_data">
38             <column name="operation" value="UPDATE"/>
39             <where>operation is NULL</where>
40         </update>
41         <rollback>
42             <dropColumn tableName="network_data">
43                 <column name="operation"/>
44             </dropColumn>
45         </rollback>
46     </changeSet>
47     <changeSet id="4.2" author="cps">
48         <comment>Remove not null constraint from payload to support delete operation</comment>
49         <dropNotNullConstraint tableName="network_data" columnName="payload"/>
50     </changeSet>
51 </databaseChangeLog>