Files
bflows-bandi-be/src/main/resources/db/changelog/db.changelog-1.0.0.xml
2024-11-18 16:49:01 +05:30

1789 lines
80 KiB
XML

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.0.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.23.xsd">
<changeSet id="14-08-2024_1" author="Harish Bagora">
<createTable tableName="region">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="region_pkey"/>
</column>
<column name="region_name" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="description" type="TEXT">
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="country" type="VARCHAR(100)">
<constraints nullable="false"/>
</column>
<column name="status" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="priority_area" type="VARCHAR(255)">
<constraints nullable="true"/>
</column>
<column name="population" type="INTEGER">
<constraints nullable="true"/>
</column>
<column name="area_size" type="numeric">
<constraints nullable="true"/>
</column>
<column name="gdp" type="numeric">
<constraints nullable="true"/>
</column>
<column name="unemployment_rate" type="numeric">
<constraints nullable="true"/>
</column>
<column name="infrastructure_score" type="numeric">
<constraints nullable="true"/>
</column>
<column name="education_level" type="numeric">
<constraints nullable="true"/>
</column>
<column name="healthcare_access" type="numeric">
<constraints nullable="true"/>
</column>
<column name="environmental_score" type="numeric">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="14-08-2024_2" author="Harish Bagora">
<createTable tableName="role">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="role_pkey"/>
</column>
<column name="role_name" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="role_type" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="description" type="VARCHAR(255)">
<constraints nullable="true"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="permissions" type="TEXT">
<constraints nullable="false"/>
</column>
<column name="region_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_role_region" references="region(id)"/>
</column>
</createTable>
</changeSet>
<changeSet id="14-08-2024_3" author="Harish Bagora">
<createTable tableName="gepafin_user">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="gepafin_user_pkey"/>
</column>
<column name="password" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="email" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="first_name" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="last_name" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="phone_number" type="VARCHAR(255)"/>
<column name="role_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_gepafin_user_role" references="role(id)"/>
</column>
<column name="status" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="last_login" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="organization" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="address" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="city" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="country" type="TEXT">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="21-08-2024_1" author="Rajesh Khore">
<createTable tableName="call">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="call_pkey"/>
</column>
<column name="name" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="description_short" type="TEXT"/>
<column name="description_long" type="TEXT"/>
<column name="start_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="end_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="status" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="region_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_region_call" references="region(id)"/>
</column>
<column name="amount" type="numeric">
<constraints nullable="false"/>
</column>
<column name="amount_max" type="numeric">
<constraints nullable="false"/>
</column>
<column name="documentation_requested" type="TEXT"/>
<column name="contact_info" type="TEXT"/>
<column name="submission_method" type="TEXT">
</column>
<column name="threshold" type="INTEGER">
</column>
<column name="priority_area" type="TEXT"/>
<column name="confidi" type="BOOLEAN"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="evaluation_criteria">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="evaluation_criteria_pkey"/>
</column>
<column name="call_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_call_evaluation_criteria" references="call(id)"/>
</column>
<column name="name" type="TEXT">
<constraints nullable="false"/>
</column>
<column name="description" type="TEXT"/>
<column name="score" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="faq">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="faq_pkey"/>
</column>
<column name="call_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_call_faq" references="call(id)"/>
</column>
<column name="user_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_gepafin_user_faq" references="gepafin_user(id)"/>
</column>
<column name="is_visible" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="question_short" type="VARCHAR(255)"/>
<column name="question" type="TEXT"/>
<column name="response_short" type="VARCHAR(255)"/>
<column name="response" type="TEXT"/>
<column name="response_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="document">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="document_pkey"/>
</column>
<column name="file_name" type="VARCHAR(255)">
</column>
<column name="file_path" type="TEXT"/>
<column name="call_id" type="INTEGER">
<constraints foreignKeyName="fk_call_document" references="call(id)"/>
</column>
<column name="description" type="TEXT"/>
<column name="type" type="VARCHAR(255)">
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="lookup_data">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="lookup_data_pkey"/>
</column>
<column name="title" type="VARCHAR(255)">
<constraints nullable="true"/>
</column>
<column name="type" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="value" type="TEXT">
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="call_target_audience_checklist">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="call_target_audience_checklist_pkey"/>
</column>
<column name="call_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_call_call_target_audience_checklist"
references="call(id)"/>
</column>
<column name="lookup_data_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_lookup_data_call_target_audience_checklist"
references="lookup_data(id)"/>
</column>
<column name="is_validated" type="BOOLEAN">
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="22-08-2024_1" author="Harish Bagora">
<insert tableName="region">
<column name="region_name" value="Italy"/>
<column name="description"
value="A beautiful country in Southern Europe known for its art, culture, and history."/>
<column name="created_date" value="2024-08-14 00:00:00"/>
<column name="updated_date" value="2024-08-14 00:00:00"/>
<column name="country" value="Italy"/>
<column name="status" value="ACTIVE"/>
<column name="priority_area" value="Tourism"/>
<column name="population" value="60000000"/>
<column name="area_size" value="301340"/>
<column name="gdp" value="2000000"/>
<column name="unemployment_rate" value="8.3"/>
<column name="infrastructure_score" value="85"/>
<column name="education_level" value="78"/>
<column name="healthcare_access" value="88"/>
<column name="environmental_score" value="75"/>
</insert>
</changeSet>
<changeSet id="22-08-2024_2" author="Harish Bagora">
<!-- Insert data for Beneficiaries role -->
<insert tableName="role">
<column name="role_name" value="beneficiary"/>
<column name="role_type" value="ROLE_BENEFICIARY"/>
<column name="description"
value="Companies or individuals looking for financing opportunities. They can view, search, and apply to available calls."/>
<column name="created_date" value="2024-08-14 00:00:00"/>
<column name="updated_date" value="2024-08-14 00:00:00"/>
<column name="permissions" value="VIEW_CALLS, APPLY_CALLS"/>
<column name="region_id" valueComputed="1"/>
</insert>
<!-- Insert data for Super Admin role -->
<insert tableName="role">
<column name="role_name" value="super admin"/>
<column name="role_type" value="ROLE_SUPER_ADMIN"/>
<column name="description"
value="Manages the creation and publication of tenders and administers internal system users."/>
<column name="created_date" value="2024-08-14 00:00:00"/>
<column name="updated_date" value="2024-08-14 00:00:00"/>
<column name="permissions" value="MANAGE_TENDERS, MANAGE_USERS"/>
<column name="region_id" valueComputed="1"/>
</insert>
<!-- Insert data for Pre-instructors role -->
<insert tableName="role">
<column name="role_name" value="pre instructor"/>
<column name="role_type" value="ROLE_PRE_INSTRUCTOR"/>
<column name="description"
value="They evaluate the applications sent by beneficiaries and manage the preliminary relief process."/>
<column name="created_date" value="2024-08-14 00:00:00"/>
<column name="updated_date" value="2024-08-14 00:00:00"/>
<column name="permissions" value="EVALUATE_APPLICATIONS, MANAGE_PRELIMINARY_RELIEF"/>
<column name="region_id" valueComputed="1"/>
</insert>
<!-- Insert data for Gepafin Operators role -->
<insert tableName="role">
<column name="role_name" value="gepafin operator"/>
<column name="role_type" value="ROLE_GEPAFIN_OPERATOR"/>
<column name="description"
value="They manage the subsequent phases of the evaluation after the pre-investigation."/>
<column name="created_date" value="2024-08-14 00:00:00"/>
<column name="updated_date" value="2024-08-14 00:00:00"/>
<column name="permissions" value="MANAGE_SUBSEQUENT_PHASES"/>
<column name="region_id" valueComputed="1"/>
</insert>
</changeSet>
<changeSet id="22-08-2024_3" author="Harish Bagora">
<!-- Insert Super User -->
<insert tableName="gepafin_user">
<column name="password" value="$2a$10$doUyOcEm8WPuFfpFT5y18.1DvZzF7exbqgy9X0P27cUBK7YWbfzzS"/>
<column name="email" value="superUser@test.test"/>
<column name="first_name" value="Super"/>
<column name="last_name" value="User"/>
<column name="phone_number" value="1234567890"/>
<column name="role_id" valueComputed="2"/>
<column name="status" value="ACTIVE"/>
<column name="last_login" value="2024-08-14 00:00:00"/>
<column name="created_date" value="2024-08-14 00:00:00"/>
<column name="updated_date" value="2024-08-14 00:00:00"/>
<column name="organization" value="SuperOrg"/>
<column name="address" value="123 Main Street"/>
<column name="city" value="Rome"/>
<column name="country" value="Italy"/>
</insert>
<!-- Insert Beneficiary User -->
<insert tableName="gepafin_user">
<column name="password" value="$2a$10$doUyOcEm8WPuFfpFT5y18.1DvZzF7exbqgy9X0P27cUBK7YWbfzzS"/>
<column name="email" value="test@test.test"/>
<column name="first_name" value="Test"/>
<column name="last_name" value="User"/>
<column name="phone_number" value="0987654321"/>
<column name="role_id" valueComputed="1"/>
<column name="status" value="ACTIVE"/>
<column name="last_login" value="2024-08-14 00:00:00"/>
<column name="created_date" value="2024-08-14 00:00:00"/>
<column name="updated_date" value="2024-08-14 00:00:00"/>
<column name="organization" value="TestOrg"/>
<column name="address" value="456 Market Street"/>
<column name="city" value="Milan"/>
<column name="country" value="Italy"/>
</insert>
</changeSet>
<changeSet id="29-08-2024_1" author="Rajesh Khore">
<createTable tableName="form">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="form_pkey"/>
</column>
<column name="label" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="call_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_call_form" references="call(id)"/>
</column>
<column name="content" type="TEXT">
<constraints nullable="false"/>
</column>
<column name="order_no" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="form_template">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="form_template_pkey"/>
</column>
<column name="label" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="content" type="TEXT">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="form_field">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="form_field_pkey"/>
</column>
<column name="name" type="VARCHAR(255)">
<constraints nullable="true"/>
</column>
<column name="label" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="settings" type="TEXT">
<constraints nullable="false"/>
</column>
<column name="validators" type="TEXT">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="27-08-2024_1" author="Rajesh Khore">
<dropColumn tableName="EVALUATION_CRITERIA"
columnName="name"/>
<dropColumn tableName="EVALUATION_CRITERIA"
columnName="description"/>
<addColumn tableName="EVALUATION_CRITERIA">
<column name="lookup_data_id" type="INTEGER">
<constraints nullable="false"
foreignKeyName="fk_lookup_data_evaluation_criteria"
references="lookup_data(id)"/>
</column>
</addColumn>
</changeSet>
<changeSet id="27-08-2024_2" author="Rajesh Khore">
<addColumn tableName="FAQ">
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
<addColumn tableName="CALL_TARGET_AUDIENCE_CHECKLIST">
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
<addColumn tableName="EVALUATION_CRITERIA">
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
<addColumn tableName="DOCUMENT">
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
<changeSet id="23-08-2024_1" author="Harish Bagora">
<addColumn tableName="gepafin_user">
<column name="reset_password_token" type="VARCHAR(255)">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>
<changeSet id="30-08-2024_1" author="Rajesh Khore">
<sqlFile dbms="postgresql"
path="db/dump/inserted_form_field_data_30_08_2024.sql"/>
<sql dbms="postgresql">select
setval('gepafin_schema.form_field_id_seq', (select
max(id)+1
from gepafin_schema.form_field), false)
</sql>
</changeSet>
<changeSet id="27-08-2024_3" author="Rajesh Khore">
<dropNotNullConstraint tableName="call" columnName="name"/>
<dropNotNullConstraint tableName="call" columnName="start_date"/>
<dropNotNullConstraint tableName="call" columnName="end_date"/>
<dropNotNullConstraint tableName="call" columnName="status"/>
<dropNotNullConstraint tableName="call" columnName="region_id"/>
<dropNotNullConstraint tableName="call" columnName="amount"/>
<dropNotNullConstraint tableName="call" columnName="amount_max"/>
</changeSet>
<changeSet id="29-08-2024_1" author="Harish Bagora">
<addColumn tableName="FAQ">
<column name="lookup_data_id" type="INTEGER">
<constraints nullable="false"
foreignKeyName="fk_lookup_data_faq"
references="lookup_data(id)"/>
</column>
</addColumn>
</changeSet>
<changeSet id="02-09-2024_1" author="Rajesh Khore">
<dropColumn tableName="FORM"
columnName="order_no"/>
</changeSet>
<changeSet id="03-09-2024_1" author="Rajesh Khore">
<sql>
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
</sql>
<sqlFile dbms="postgresql"
path="db/dump/update_form_field_data_04_09_2024.sql"/>
</changeSet>
<changeSet id="04-09-2024_1" author="Rajesh Khore">
<dropColumn tableName="FAQ" columnName="question_short"/>
<dropColumn tableName="FAQ" columnName="question"/>
<dropColumn tableName="FAQ" columnName="response_short"/>
<dropColumn tableName="FAQ" columnName="lookup_data_id"/>
<addColumn tableName="FAQ">
<column name="title" type="TEXT"/>
<column name="value" type="TEXT"/>
</addColumn>
<addColumn tableName="LOOKUP_DATA">
<column name="response" type="TEXT"/>
</addColumn>
<modifyDataType tableName="LOOKUP_DATA" columnName="title" newDataType="TEXT"/>
</changeSet>
<changeSet id="09-09-2024_2" author="Harish Bagora">
<renameColumn tableName="document" oldColumnName="call_id" newColumnName="source_id" columnDataType="BIGINT"/>
<addColumn tableName="document">
<column name="source" type="VARCHAR(255)"/>
</addColumn>
<dropColumn tableName="document" columnName="description"/>
<dropForeignKeyConstraint baseTableName="document" constraintName="fk_call_document"/>
</changeSet>
<changeSet id="09-09-2024_1" author="Rajesh Khore">
<createTable tableName="application_form">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="application_form_pkey"/>
</column>
<column name="form_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_form_application_form" references="form(id)"/>
</column>
<column name="order_no" type="VARCHAR(255)"></column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="application_form_field">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="application_form_field_pkey"/>
</column>
<column name="application_form_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_application_form_application_form_field"
references="application_form(id)"/>
</column>
<column name="field_id" type="VARCHAR(255)"></column>
<column name="field_value" type="VARCHAR(255)"></column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="flow_edges">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="flow_edges_pkey"/>
</column>
<column name="call_id" type="INTEGER">
</column>
<column name="source_id" type="INTEGER"></column>
<column name="target_id" type="INTEGER"></column>
<column name="type" type="VARCHAR(255)"></column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<createTable tableName="flow_data">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="flow_data_pkey"/>
</column>
<column name="call_id" type="INTEGER">
</column>
<column name="form_id" type="INTEGER"></column>
<column name="choosen_field" type="VARCHAR(255)"></column>
<column name="choosen_value" type="VARCHAR(255)"></column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<addColumn tableName="call">
<column name="initial_form" type="INTEGER"></column>
<column name="final_form" type="INTEGER"></column>
</addColumn>
</changeSet>
<changeSet id="11-09-2024_1" author="Rajesh Khore">
<createTable tableName="application">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="application_pkey"/>
</column>
<column name="user_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_user_application" references="gepafin_user(id)"/>
</column>
<column name="submission_date" type="TIMESTAMP WITHOUT TIME ZONE"></column>
<column name="status" type="VARCHAR(255)"></column>
<column name="comments" type="TEXT"></column>
<column name="call_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_call_application" references="call(id)"/>
</column>
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
<addColumn tableName="application_form">
<column name="application_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_application_application_form"
references="application(id)"/>
</column>
</addColumn>
<dropColumn tableName="application_form">
<column name="order_no" type="VARCHAR(255)"></column>
</dropColumn>
</changeSet>
<changeSet id="13-09-2024_1" author="Harish Bagora">
<addColumn tableName="form_field">
<column name="description" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="sort_order" type="INTEGER">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>
<changeSet id="13-09-2024_2" author="Harish Bagora">
<sql>
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
</sql>
<sqlFile dbms="postgresql"
path="classpath:db/dump/inserted_form_field_data_13_09_2024.sql"/>
</changeSet>
<changeSet id="12-09-2024_1" author="Rajesh Khore">
<addColumn tableName="flow_edges">
<column name="tracking_id" type="VARCHAR(255)"></column>
</addColumn>
</changeSet>
<changeSet id="16-09-2024_1" author="Harish Bagora">
<sql>
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
</sql>
<sqlFile dbms="postgresql"
path="classpath:db/dump/updated_form_field_data_16-09-2024.sql"/>
</changeSet>
<changeSet id="23-09-2024_1" author="Harish Bagora" dbms="postgresql">
<!-- Procedure for automatically setting the updated_date -->
<createProcedure>
CREATE OR REPLACE FUNCTION gepafin_schema.clock_timestamp_updated_date_column()
RETURNS TRIGGER
LANGUAGE plpgsql
AS $$
BEGIN
NEW.updated_date = clock_timestamp();
RETURN NEW;
END;
$$;
</createProcedure>
<createProcedure>
CREATE OR REPLACE FUNCTION gepafin_schema.clock_timestamp_created_date_column()
RETURNS TRIGGER
LANGUAGE plpgsql
AS $$
BEGIN
IF NEW.created_date IS NULL THEN
NEW.created_date = clock_timestamp();
END IF;
NEW.updated_date = NEW.created_date;
RETURN NEW;
END;
$$;
</createProcedure>
</changeSet>
<changeSet id="23-09-2024_1" author="Rajesh Khore">
<createTable tableName="saml_response">
<column name="id" type="INTEGER" autoIncrement="true"></column>
<column name="authentication_object" type="TEXT"></column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"></column>
<column name="token" type="varchar(255)"></column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"></column>
</createTable>
</changeSet>
<changeSet id="24-09-2024_1" author="Harish Bagora">
<createTable tableName="hub">
<column name="ID" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false" unique="true" primaryKeyName="hub_pkey"/>
</column>
<column name="COMPANY_NAME" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="FIRST_NAME" type="VARCHAR(255)"/>
<column name="LAST_NAME" type="VARCHAR(255)"/>
<column name="EMAIL" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="CITY" type="VARCHAR(255)"/>
<column name="COUNTRY" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="VAT_NUMBER" type="VARCHAR(255)">
<constraints nullable="false" unique="true"/>
</column>
<column name="DOMAIN_NAME" type="VARCHAR(255)"/>
<column name="APP_CONFIG" type="TEXT"/>
<column name="UNIQUE_UUID" type="VARCHAR(255)">
<constraints nullable="false" unique="true"/>
</column>
<column name="CREATED_DATE" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="UPDATED_DATE" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="24-09-2024_2" author="Harish Bagora">
<insert tableName="hub">
<column name="COMPANY_NAME" value="bandi gepafin Company"/>
<column name="FIRST_NAME" value="John"/>
<column name="LAST_NAME" value="Doe"/>
<column name="EMAIL" value="john.doe@test.test"/>
<column name="CITY" value="rome"/>
<column name="COUNTRY" value="italy"/>
<column name="VAT_NUMBER" value="12345678974"/>
<column name="DOMAIN_NAME" value="https://bandi-staging.memento.credit"/>
<column name="APP_CONFIG" value="{}"/>
<column name="UNIQUE_UUID" value="p4lk3bcx1RStqTaIVVbXs"/>
<column name="created_date" value="2024-10-24 00:00:00"/>
<column name="updated_date" value="2024-10-24 00:00:00"/>
</insert>
<insert tableName="hub">
<column name="COMPANY_NAME" value="sviluppumbria"/>
<column name="FIRST_NAME" value="svilupp"/>
<column name="LAST_NAME" value="umbria"/>
<column name="EMAIL" value="sviluppumbria@test.test"/>
<column name="CITY" value="rome"/>
<column name="COUNTRY" value="italy"/>
<column name="VAT_NUMBER" value="98765432152"/>
<column name="DOMAIN_NAME" value="https://bandi-staging.sviluppumbria.it"/>
<column name="APP_CONFIG" value="{}"/>
<column name="UNIQUE_UUID" value="t7jh5wfg9QXylNaTZkPoE"/>
<column name="created_date" value="2024-10-24 00:00:00"/>
<column name="updated_date" value="2024-10-24 00:00:00"/>
</insert>
</changeSet>
<changeSet id="25-09-2024_2" author="Nisha kashyap">
<update tableName="form_field">
<column name="name" value="textinput"/>
<where>id = 13</where>
</update>
</changeSet>
<changeSet id="25-09-2024_1" author="Rajesh Khore">
<addColumn tableName="gepafin_user">
<column name="codice_fiscale" type="varchar(255)">
<constraints nullable="true" unique="true"/>
</column>
<column name="date_of_birth" type="TIMESTAMP WITHOUT TIME ZONE"></column>
</addColumn>
<dropNotNullConstraint tableName="gepafin_user" columnName="password"/>
</changeSet>
<changeSet id="27-09-2024_1" author="Rajesh Khore">
<createTable tableName="beneficiary">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true"
primaryKeyName="beneficiary_pkey"/>
</column>
<column name="EMAIL" type="VARCHAR(255)"/>
<column name="FIRST_NAME" type="VARCHAR(255)"/>
<column name="LAST_NAME" type="VARCHAR(255)"/>
<column name="PHONE_NUMBER" type="VARCHAR(255)"/>
<column name="ORGANIZATION" type="TEXT"/>
<column name="ADDRESS" type="TEXT"/>
<column name="CITY" type="TEXT"/>
<column name="COUNTRY" type="TEXT"/>
<column name="CODICE_FISCALE" type="varchar(255)">
<constraints nullable="true" unique="true"/>
</column>
<column name="DATE_OF_BIRTH" type="TIMESTAMP"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
<dropColumn tableName="gepafin_user" columnName="codice_fiscale"/>
<dropNotNullConstraint tableName="gepafin_user" columnName="first_name"/>
<dropNotNullConstraint tableName="gepafin_user" columnName="last_name"/>
<addColumn tableName="gepafin_user">
<column name="beneficiary_id" type="INTEGER">
<constraints nullable="true" foreignKeyName="fk_beneficiary_gepafin_user" references="beneficiary(id)"/>
</column>
</addColumn>
</changeSet>
<changeSet id="27-09-2024_2" author="Rajesh Khore">
<createTable tableName="COMPANY">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true"
primaryKeyName="company_pkey"/>
</column>
<column name="COMPANY_NAME" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="VAT_NUMBER" type="VARCHAR(255)">
<constraints nullable="true" unique="true"/>
</column>
<column name="CODICE_FISCALE" type="VARCHAR(255)"/>
<column name="ADDRESS" type="VARCHAR(255)"/>
<column name="PHONE_NUMBER" type="VARCHAR(255)"/>
<column name="CITY" type="VARCHAR(255)"/>
<column name="PROVINCE" type="VARCHAR(255)"/>
<column name="CAP" type="VARCHAR(255)"/>
<column name="COUNTRY" type="VARCHAR(255)"/>
<column name="PEC" type="VARCHAR(255)"/>
<column name="EMAIL" type="VARCHAR(255)"/>
<column name="NUMBER_OF_EMPLOYEES" type="VARCHAR(255)"/>
<column name="ANNUAL_REVENUE" type="NUMERIC"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
</changeSet>
<changeSet id="27-09-2024_3" author="Rajesh Khore">
<createTable tableName="USER_WITH_COMPANY">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true"
primaryKeyName="user_with_company_pkey"/>
</column>
<column name="USER_ID" type="INTEGER"/>
<column name="BENEFICIARY_ID" type="INTEGER"/>
<column name="COMPANY_ID" type="INTEGER"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
</changeSet>
<changeSet id="27-09-2024_4" author="Rajesh Khore">
<addColumn tableName="APPLICATION">
<column name="COMPANY_ID" type="INTEGER">
<constraints nullable="true" foreignKeyName="fk_COMPANY_APPLICATION" references="company(id)"/>
</column>
</addColumn>
<addColumn tableName="FAQ">
<column name="COMPANY_ID" type="INTEGER"/>
</addColumn>
</changeSet>
<changeSet id="01-10-2024_1" author="Nisha Kashyap">
<addColumn tableName="call">
<column name="amount_min" type="numeric"></column>
<column name="phone_number" type="VARCHAR(255)"></column>
<column name="email" type="VARCHAR(255)"></column>
<column name="end_time" type="TIME"></column>
<column name="start_time" type="TIME"></column>
</addColumn>
</changeSet>
<changeSet id="03-10-2024_1" author="Nisha Kashyap">
<sql>
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
</sql>
<sqlFile dbms="postgresql"
path="classpath:db/dump/updated_form_field_data_03-10-2024.sql"/>
</changeSet>
<changeSet id="08-10-2024_1" author="Rajesh Khore">
<createTable tableName="user_company_delegation">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true"
primaryKeyName="user_company_delegation_pkey"/>
</column>
<column name="USER_ID" type="INTEGER"/>
<column name="COMPANY_ID" type="INTEGER"/>
<column name="BENEFICIARY_ID" type="INTEGER"/>
<column name="FILE_NAME" type="VARCHAR(255)"/>
<column name="FILE_PATH" type="VARCHAR(255)"/>
<column name="STATUS" type="VARCHAR(50)"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
<!-- Optional: If you have any indexes, constraints, or foreign keys -->
<addForeignKeyConstraint
baseTableName="user_company_delegation" baseColumnNames="USER_ID"
referencedTableName="gepafin_user" referencedColumnNames="ID"
constraintName="fk_user_company_delegation_gepafin_user"/>
<addForeignKeyConstraint
baseTableName="user_company_delegation" baseColumnNames="COMPANY_ID"
referencedTableName="company" referencedColumnNames="ID"
constraintName="fk_user_company_delegation_company"/>
<addForeignKeyConstraint
baseTableName="user_company_delegation"
baseColumnNames="BENEFICIARY_ID" referencedTableName="beneficiary"
referencedColumnNames="ID"
constraintName="fk_user_company_delegation_beneficiary"/>
</changeSet>
<changeSet id="08-10-2024_2" author="Rajesh Khore">
<addColumn tableName="user_with_company">
<column name="IS_LEGAL_REPRESENTANT" type="BOOLEAN"/>
</addColumn>
</changeSet>
<changeSet id="03-10-2024_2" author="Nisha Kashyap">
<sql>
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
</sql>
<sqlFile dbms="postgresql"
path="classpath:db/dump/updated_form_field_data_03-10-2024_1.sql"/>
</changeSet>
<changeSet id="07-10-2024_1" author="Harish Bagora">
<addColumn tableName="beneficiary">
<column name="PRIVACY" type="BOOLEAN" defaultValueBoolean="false"/>
<column name="TERMS" type="BOOLEAN" defaultValueBoolean="false"/>
<column name="MARKETING" type="BOOLEAN"/>
<column name="OFFERS" type="BOOLEAN"/>
<column name="THIRD_PARTY" type="BOOLEAN"/>
<column name="email_pec" type="VARCHAR(255)"/>
</addColumn>
<addNotNullConstraint tableName="beneficiary" columnName="PRIVACY"/>
<addNotNullConstraint tableName="beneficiary" columnName="TERMS"/>
<addColumn tableName="COMPANY">
<column name="contact_name" type="VARCHAR(255)"/>
<column name="contact_email" type="VARCHAR(255)"/>
</addColumn>
</changeSet>
<changeSet id="07-10-2024_2" author="Nisha Kashyap">
<modifyDataType
tableName="application_form_field"
columnName="field_value"
newDataType="TEXT"/>
</changeSet>
<changeSet id="08-10-2024_2" author="Nisha Kashyap">
<createTable tableName="protocol">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true"
primaryKeyName="protocol_pkey"/>
</column>
<column name="protocol_number" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="year" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="call_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="time" type="TIME">
<constraints nullable="false"/>
</column>
<column name="application_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
<addColumn tableName="application">
<column name="protocol_number" type="INTEGER">
</column>
</addColumn>
</changeSet>
<changeSet id="11-10-2024_1" author="Harish Bagora">
<createTable tableName="beneficiary_preferred_call">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="beneficiary_preferred_call_pkey"/>
</column>
<column name="beneficiary_id" type="BIGINT"/>
<column name="user_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="company_id" type="BIGINT"/>
<column name="call_id" type="BIGINT"/>
<column name="status" type="VARCHAR(255)"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="10-10-2024_1" author="Rajesh Khore">
<createTable tableName="system_email_template">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true"
primaryKeyName="system_email_template_pkey"/>
</column>
<column name="TEMPLATE_NAME" type="VARCHAR(255)"/>
<column name="TYPE" type="VARCHAR(255)"/>
<column name="HTML_CONTENT" type="TEXT"/>
<column name="SUBJECT" type="TEXT"/>
<column name="JSON" type="TEXT"/>
<column name="SYSTEM" type="BOOLEAN"/>
<column name="IS_DELETED" type="BOOLEAN" defaultValueBoolean="true">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
</changeSet>
<changeSet id="10-10-2024_2" author="Rajesh Khore">
<sqlFile dbms="postgresql"
path="db/dump/insert_system_email_template_for_application_submission.sql"/>
</changeSet>
<changeSet id="12-10-2024_1" author="Rajesh Khore">
<createTable tableName="application_signed_document">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints primaryKey="true" primaryKeyName="application_signed_document_pkey" nullable="false"/>
</column>
<column name="APPLICATION_ID" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="FILE_NAME" type="VARCHAR(255)"/>
<column name="FILE_PATH" type="VARCHAR(255)"/>
<column name="STATUS" type="VARCHAR(64)"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
<addForeignKeyConstraint baseTableName="application_signed_document"
baseColumnNames="APPLICATION_ID"
referencedTableName="application"
referencedColumnNames="ID"
constraintName="fk_application_signed_document_application"/>
</changeSet>
<changeSet id="13-10-2024_1" author="Rajesh Khore">
<update tableName="form_field">
<column name="validators" value='{"custom": "nonEmptyTables"}'/>
<where>name='table'</where>
</update>
</changeSet>
<changeSet id="14-10-2024_1" author="Harish Bagora">
<sqlFile dbms="postgresql"
path="db/dump/update_system_email_template_of_application_submission.sql"/>
</changeSet>
<changeSet id="15-10-2024_2" author="Nisha Kashyap">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="login_attempt"/>
</not>
</preConditions>
<createTable tableName="login_attempt">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="login_attempt_pkey"/>
</column>
<column name="username" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="user_id" type="INTEGER"/>
<column name="attempt_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="ip_address" type="VARCHAR(100)"/>
<column name="user_agent" type="VARCHAR(255)"/>
<column name="result" type="VARCHAR(100)">
<constraints nullable="false"/>
</column>
<column name="attempt_type" type="VARCHAR(100)" defaultValue="LOGIN">
<constraints nullable="false"/>
</column>
<column name="error_msg" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet id="15-10-2024_1" author="Harish Bagora">
<insert tableName="gepafin_user">
<column name="password" value="$2a$10$doUyOcEm8WPuFfpFT5y18.1DvZzF7exbqgy9X0P27cUBK7YWbfzzS"/>
<column name="email" value="instructor@test.test"/>
<column name="first_name" value="Test"/>
<column name="last_name" value="Instructor"/>
<column name="phone_number" value="9876543210"/>
<column name="role_id" valueComputed="3"/>
<column name="status" value="ACTIVE"/>
<column name="last_login" value="2024-10-15 00:00:00"/>
<column name="created_date" value="2024-10-15 00:00:00"/>
<column name="updated_date" value="2024-10-15 00:00:00"/>
<column name="organization" value="PreInstructorOrg"/>
<column name="address" value="789 Victory Road"/>
<column name="city" value="Naples"/>
<column name="country" value="Italy"/>
</insert>
</changeSet>
<changeSet id="16-10-2024_2" author="Rajesh Khore">
<createTable tableName="criteria_form_field">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="criteria_form_field_pkey"/>
</column>
<column name="call_id" type="INTEGER"/>
<column name="form_id" type="INTEGER"/>
<column name="form_field_id" type="varchar(255)"/>
<column name="evaluation_criteria_id" type="INTEGER"/>
<column name="IS_DELETED" type="BOOLEAN" defaultValueBoolean="true">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
<addForeignKeyConstraint baseTableName="criteria_form_field"
baseColumnNames="call_id"
referencedTableName="call"
referencedColumnNames="id"
constraintName="fk_criteria_form_field_call_id"/>
<addForeignKeyConstraint baseTableName="criteria_form_field"
baseColumnNames="form_id"
referencedTableName="form"
referencedColumnNames="id"
constraintName="fk_criteria_form_field_form_id"/>
<addForeignKeyConstraint baseTableName="criteria_form_field"
baseColumnNames="evaluation_criteria_id"
referencedTableName="evaluation_criteria"
referencedColumnNames="id"
constraintName="fk_criteria_form_field_evaluation_criteria_id"/>
</changeSet>
<changeSet id="16-10-2024_1" author="Harish Bagora">
<addColumn tableName="user_with_company">
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
<changeSet id="21-10-2024_1" author="Harish Bagora">
<createTable tableName="assigned_applications">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="pk_assigned_applications"/>
</column>
<column name="user_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="assigned_by" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="application_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_application_assigned_applications"
references="application(id)"/>
</column>
<column name="STATUS" type="VARCHAR(50)"/>
<column name="note" type="TEXT"></column>
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
<column name="assigned_at" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="17-10-2024_1" author="Rajesh Khore">
<!-- Step 1: Add the HUB_ID column as nullable initially -->
<addColumn tableName="GEPAFIN_USER">
<column name="HUB_ID" type="INTEGER"/>
</addColumn>
<addColumn tableName="CALL">
<column name="HUB_ID" type="INTEGER"/>
</addColumn>
<!-- Step 2: Update the HUB_ID column with a default value -->
<update tableName="GEPAFIN_USER">
<column name="HUB_ID" value="1"/> <!-- Set to the default hub id -->
</update>
<update tableName="CALL">
<column name="HUB_ID" value="1"/> <!-- Set to the default hub id -->
</update>
<!-- Step 3: Alter the columns to be NOT NULL and add foreign key constraints -->
<addNotNullConstraint tableName="GEPAFIN_USER" columnName="HUB_ID" columnDataType="INTEGER"/>
<addNotNullConstraint tableName="CALL" columnName="HUB_ID" columnDataType="INTEGER"/>
<addForeignKeyConstraint baseTableName="GEPAFIN_USER"
baseColumnNames="HUB_ID"
referencedTableName="HUB"
referencedColumnNames="ID"
constraintName="fk_hub_gepafin_user"/>
<addForeignKeyConstraint baseTableName="CALL"
baseColumnNames="HUB_ID"
referencedTableName="HUB"
referencedColumnNames="ID"
constraintName="fk_hub_gepafin_call"/>
</changeSet>
<changeSet id="19-10-2024_1" author="Harish Bagora">
<addColumn tableName="saml_response">
<column name="IN_RESPONSE_TO" type="TEXT"/>
<column name="ISSUE_INSTANT" type="TEXT"/>
<column name="SAML_ID" type="TEXT"/>
<column name="HUB_UUID" type="varchar(255)"/>
<column name="status" type="varchar(255)"/>
</addColumn>
<addColumn tableName="protocol">
<column name="HUB_ID" type="TEXT"/>
</addColumn>
<insert tableName="gepafin_user">
<column name="password" value="$2a$10$doUyOcEm8WPuFfpFT5y18.1DvZzF7exbqgy9X0P27cUBK7YWbfzzS"/>
<column name="email" value="sviluppumbriaUser@test.test"/>
<column name="first_name" value="Super"/>
<column name="last_name" value="User"/>
<column name="phone_number" value="1234567890"/>
<column name="role_id" valueComputed="2"/>
<column name="status" value="ACTIVE"/>
<column name="last_login" value="2024-08-14 00:00:00"/>
<column name="created_date" value="2024-08-14 00:00:00"/>
<column name="updated_date" value="2024-08-14 00:00:00"/>
<column name="organization" value="SuperOrg"/>
<column name="address" value="123 Main Street"/>
<column name="city" value="Rome"/>
<column name="country" value="Italy"/>
<column name="HUB_ID" value="2"/>
</insert>
</changeSet>
<changeSet id="19-10-2024_2" author="Harish Bagora">
<modifyDataType tableName="protocol" columnName="HUB_ID" newDataType="INTEGER"/>
<addForeignKeyConstraint baseTableName="protocol"
baseColumnNames="HUB_ID"
constraintName="fk_protocol_hub"
referencedTableName="hub"
referencedColumnNames="id"/>
</changeSet>
<changeSet id="24-10-2024_1" author="Rajesh Khore">
<dropUniqueConstraint
constraintName="company_vat_number_key"
tableName="company"/>
<addColumn tableName="company">
<column name="hub_id" type="INTEGER" defaultValue="1">
<constraints nullable="false"/>
</column>
</addColumn>
<addUniqueConstraint
columnNames="VAT_NUMBER, hub_id"
tableName="company"
constraintName="uk_vat_hub"/>
<addForeignKeyConstraint
baseTableName="company"
baseColumnNames="hub_id"
referencedTableName="hub"
referencedColumnNames="id"
constraintName="fk_company_hub"/>
</changeSet>
<changeSet id="24-10-2024_2" author="Rajesh Khore">
<dropUniqueConstraint
constraintName="beneficiary_codice_fiscale_key"
tableName="beneficiary"/>
<addColumn tableName="beneficiary">
<column name="hub_id" type="INTEGER" defaultValue="1">
<constraints nullable="false"/>
</column>
</addColumn>
<addUniqueConstraint
columnNames="CODICE_FISCALE, hub_id"
tableName="beneficiary"
constraintName="uk_codice_hub"/>
<addForeignKeyConstraint
baseTableName="beneficiary"
baseColumnNames="hub_id"
referencedTableName="hub"
referencedColumnNames="id"
constraintName="fk_beneficiary_hub"/>
</changeSet>
<changeSet id="24-10-2024_3" author="Rajesh Khore">
<addColumn tableName="application">
<column name="hub_id" type="INTEGER" defaultValue="1">
<constraints nullable="false"/>
</column>
</addColumn>
<addForeignKeyConstraint
baseTableName="application"
baseColumnNames="hub_id"
referencedTableName="hub"
referencedColumnNames="id"
constraintName="fk_application_hub"/>
</changeSet>
<changeSet id="25-10-2024_1" author="Piyush">
<createTable tableName="s3_path_configuration">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="s3_path_configuration_pkey"/>
</column>
<column name="type" type="VARCHAR(100)">
<constraints nullable="false"/>
</column>
<column name="bucket_name" type="VARCHAR(500)">
<constraints nullable="false"/>
</column>
<column name="parent_folder" type="VARCHAR(100)">
<constraints nullable="false"/>
</column>
<column name="path" type="VARCHAR(500)">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="25-10-2024_2" author="Piyush">
<insert tableName="s3_path_configuration">
<column name="type" value="CALL"/>
<column name="path" value="call/{call_id}"/>
<column name="bucket_name" value="mementoresources"/>
<column name="created_date" value="2024-10-25 03:00:00"/>
<column name="updated_date" value="2024-10-25 03:00:00"/>
<column name="parent_folder" value="gepafin/local"/>
</insert>
<insert tableName="s3_path_configuration">
<column name="type" value="APPLICATION"/>
<column name="path" value="call/{call_id}/application/{application_id}"/>
<column name="bucket_name" value="mementoresources"/>
<column name="created_date" value="2024-10-25 03:00:00"/>
<column name="updated_date" value="2024-10-25 03:00:00"/>
<column name="parent_folder" value="gepafin/local"/>
</insert>
<insert tableName="s3_path_configuration">
<column name="type" value="USER_SIGNED_DOCUMENT"/>
<column name="path" value="call/{call_id}/application/{application_id}/user_signed_document"/>
<column name="bucket_name" value="mementoresources"/>
<column name="created_date" value="2024-10-25 03:00:00"/>
<column name="updated_date" value="2024-10-25 03:00:00"/>
<column name="parent_folder" value="gepafin/local"/>
</insert>
<insert tableName="s3_path_configuration">
<column name="type" value="TEMPLATE"/>
<column name="path" value="template"/>
<column name="bucket_name" value="mementoresources"/>
<column name="created_date" value="2024-10-25 03:00:00"/>
<column name="updated_date" value="2024-10-25 03:00:00"/>
<column name="parent_folder" value="gepafin/local"/>
</insert>
<insert tableName="s3_path_configuration">
<column name="type" value="USER_DELEGATION"/>
<column name="path" value="user_delegation"/>
<column name="bucket_name" value="mementoresources"/>
<column name="created_date" value="2024-10-25 03:00:00"/>
<column name="updated_date" value="2024-10-25 03:00:00"/>
<column name="parent_folder" value="gepafin/local"/>
</insert>
</changeSet>
<changeSet id="26-10-2024_1" author="Harish Bagora">
<createTable tableName="application_evaluation">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true" primaryKeyName="application_evaluation_pkey"/>
</column>
<column name="assigned_applications_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="application_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="user_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="criteria" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="checklist" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="file" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="note" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="status" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</createTable>
<addForeignKeyConstraint
baseTableName="application_evaluation"
baseColumnNames="user_id"
referencedTableName="gepafin_user"
referencedColumnNames="id"
constraintName="fk_application_evaluation_gepafin_user"
onDelete="CASCADE"/>
<addForeignKeyConstraint
baseTableName="application_evaluation"
baseColumnNames="assigned_applications_id"
referencedTableName="assigned_applications"
referencedColumnNames="id"
constraintName="fk_application_evaluation_assigned_applications"
onDelete="CASCADE"/>
</changeSet>
<changeSet id="27-10-2024_1" author="Rajesh Khore">
<createTable tableName="application_amendment_request">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="pk_application_amendment_request"/>
</column>
<column name="note" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="response_days" type="INTEGER">
<constraints nullable="true"/>
</column>
<column name="is_notification" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="is_email" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="form_fields" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
<column name="application_id" type="INTEGER">
<constraints nullable="true"/>
</column>
<column name="application_evaluation_id" type="INTEGER">
<constraints nullable="false"
foreignKeyName="fk_application_evaluation_application_amendment_request"
references="application_evaluation(id)"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="28-10-2024_1" author="Piyush">
<createTable tableName="communication">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="pk_communication"/>
</column>
<column name="communication_title" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="communication_comment" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="true"/>
</column>
<column name="commented_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="amendment_id" type="INTEGER">
<constraints nullable="false"/>
</column>
</createTable>
<!-- Add foreign key constraint between communication and application_amendment_request -->
<addForeignKeyConstraint baseTableName="communication"
baseColumnNames="amendment_id"
referencedTableName="application_amendment_request"
referencedColumnNames="id"
constraintName="fk_communication_application_amendment_request"/>
</changeSet>
<changeSet id="28-10-2024_3" author="Rajesh Khore">
<addColumn tableName="application_amendment_request">
<column name="protocol_id" type="INTEGER"/>
</addColumn>
<addForeignKeyConstraint
baseTableName="application_amendment_request"
baseColumnNames="protocol_id"
referencedTableName="protocol"
referencedColumnNames="id"
constraintName="fk_application_amendment_request_protocol"/>
</changeSet>
<changeSet id="29-10-2024_1" author="Rajesh Khore">
<addColumn tableName="application_amendment_request">
<column name="start_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="status" type="VARCHAR(50)"/>
<column name="internal_note" type="TEXT"></column>
</addColumn>
</changeSet>
<changeSet id="29-10-2024_2" author="Piyush">
<addColumn tableName="hub">
<column name="EMAIL_SERVICE_TYPE" type="TEXT"/>
<column name="EMAIL_SERVICE_CONFIG" type="TEXT"/>
</addColumn>
</changeSet>
<changeSet id="29-10-2024_3" author="Piyush">
<sqlFile dbms="postgresql"
path="db/dump/insert_system_email_template_for_notification_mail_31_10_2024.sql"/>
</changeSet>
<changeSet id="30-10-2024_1" author="Nisha Kashyap">
<addColumn tableName="hub">
<column name="pdf_banner" type="TEXT"></column>
</addColumn>
<update tableName="hub">
<column name="pdf_banner"
value='https://mementoresources.s3.amazonaws.com/gepafin/staging/template/gepafin-logo.jpg'/>
<where>UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs'</where>
</update>
<update tableName="hub">
<column name="pdf_banner"
value='https://mementoresources.s3.amazonaws.com/gepafin/staging/template/sviluppumbria_logo.jpg'/>
<where>UNIQUE_UUID = 't7jh5wfg9QXylNaTZkPoE'</where>
</update>
</changeSet>
<changeSet id="30-10-2024_2" author="Piyush">
<sqlFile dbms="postgresql"
path="db/dump/update_hub_data_for_email_service_config_31_10_2024_1.sql"/>
</changeSet>
<changeSet id="31-10-2024_1" author="Rajesh Khore">
<addColumn tableName="hub">
<column name="EMAIL_SIGNATURE" type="TEXT"/>
</addColumn>
</changeSet>
<changeSet id="31-10-2024_2" author="Rajesh Khore">
<sqlFile dbms="postgresql"
path="db/dump/updated_system_email_template_for_application_submition_30-10-2024.sql"/>
</changeSet>
<changeSet id="31-10-2024_3" author="Rajesh Khore">
<update tableName="hub">
<column name="EMAIL_SIGNATURE" value="Gepafin S.p.a"/>
<where>UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs'</where>
</update>
<update tableName="hub">
<column name="EMAIL_SIGNATURE" value="Sviluppumbria S.p.a"/>
<where>UNIQUE_UUID = 't7jh5wfg9QXylNaTZkPoE'</where>
</update>
</changeSet>
<changeSet id="30-10-2024_4" author="Harish Bagora">
<sql dbms="postgresql">select
setval('gepafin_schema.system_email_template_id_seq', (select
max(id)+1
from gepafin_schema.system_email_template), false)
</sql>
<sqlFile dbms="postgresql"
path="db/dump/insert_system_email_template_for_sollecito_30_10_2024.sql"/>
</changeSet>
<changeSet id="04-11-2024_1" author="Piyush">
<sqlFile dbms="postgresql"
path="db/dump/update_system_email_template_for_notification_mail_04_11_2024_1.sql"/>
</changeSet>
<changeSet id="05-11-2024_4" author="Harish Bagora">
<sqlFile dbms="postgresql"
path="db/dump/update_system_email_template_for_notification_mail_05_11_2024_4.sql"/>
</changeSet>
<changeSet id="15-11-2024_1" author="Nisha Kashyap">
<createTable tableName="email_log">
<column autoIncrement="true" name="id" type="INTEGER">
<constraints nullable="false" primaryKey="true"
primaryKeyName="pk_email_logs"/>
</column>
<column name="email_type" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="recipient_type" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="recipient_id" type="INTEGER">
</column>
<column name="email_subject" type="TEXT"/>
<column name="email_body" type="TEXT"/>
<column name="send_status" type="VARCHAR(255)"/>
<column name="send_date_time" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE" defaultValueComputed="CURRENT_TIMESTAMP"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="email_service_response" type="TEXT"></column>
<column name="email_service_type" type="VARCHAR(255)"></column>
<column name="recipient_emails" type="TEXT"></column>
<column name="user_id" type="INTEGER"></column>
<column name="error_message" type="TEXT"/>
<column name="entity_id" type="INTEGER"></column>
<column name="entity_type" type="VARCHAR(255)"></column>
</createTable>
</changeSet>
<changeSet id="15-11-2024_2" author="Nisha kashyap">
<addColumn tableName="system_email_template">
<column name="email_scenario" type="VARCHAR(255)"></column>
</addColumn>
<sqlFile dbms="postgresql"
path="db/dump/updated_system_email_template_for_email_scenario_15-11-2024.sql"/>
<sqlFile dbms="postgresql"
path="db/dump/updated_hub_data_for_email_service_config_15-11-2024.sql"/>
</changeSet>
<changeSet id="13-11-2024_1" author="Rajesh Khore">
<dropNotNullConstraint tableName="application_amendment_request" columnName="is_email"/>
<dropNotNullConstraint tableName="application_amendment_request" columnName="is_notification"/>
</changeSet>
<changeSet id="13-11-2024_2" author="Harish Bagora">
<addColumn tableName="beneficiary_preferred_call">
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
<changeSet id="18-11-2024_1" author="Nisha Kashyap">
<addColumn tableName="email_log">
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false"></column>
<column name="application_id" type="INTEGER" ></column>
<column name="amendment_id" type="INTEGER"></column>
<column name="call_id" type="INTEGER"></column>
</addColumn>
<dropColumn tableName="email_log">
<column name="entity_id"></column>
<column name="entity_type"></column>
</dropColumn>
</changeSet>
</databaseChangeLog>