blob: 1bb48450d34f1663aa5e95df5274dd53e5bdadb4 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<changeSet author="fineract" id="1" context="postgresql">
<sql>
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
</sql>
</changeSet>
<changeSet author="fineract" id="2">
<addColumn tableName="m_portfolio_command_source">
<column defaultValueComputed="NULL" name="idempotency_key" type="VARCHAR(50)"/>
</addColumn>
<update tableName="m_portfolio_command_source">
<column name="idempotency_key" valueComputed="${uuid}" />
<where>idempotency_key is null</where>
</update>
<addUniqueConstraint columnNames="action_name, entity_name, idempotency_key" constraintName="UNIQUE_PORTFOLIO_COMMAND_SOURCE"
tableName="m_portfolio_command_source"/>
<createIndex indexName="portfolio_command_source_composite_index" tableName="m_portfolio_command_source">
<column name="action_name"/>
<column name="entity_name"/>
<column name="idempotency_key"/>
</createIndex>
</changeSet>
<changeSet author="fineract" id="3" context="postgresql">
<addNotNullConstraint columnName="idempotency_key"
constraintName="mpcs_idempotency_key_nn"
tableName="m_portfolio_command_source"/>
</changeSet>
<changeSet author="fineract" id="4" context="mysql">
<sql>
ALTER TABLE m_portfolio_command_source MODIFY idempotency_key VARCHAR(50) not NULL
</sql>
</changeSet>
</databaseChangeLog>