Modifying API behavior settings at the table creation level

🌐 This document is available in both English and Ukrainian. Use the language toggle in the top right corner to switch between versions.

1. Overview

When creating new tables, regulations modeler has an ability to specify the "bulkLoad" attribute to enable data loading from files or an array to the table. Currently, there is no option to change this after table creation. Since this attribute does not alter the data structure but only affects code generation, it is necessary to add the ability to change the attribute value after table creation.

2. Functional scenarios

  • As a regulations modeler, I want to be able to modify settings that affect the behavior of the generated API code but are specified at the table creation level.

    • Enabling/disabling the ability to save an array of data from CSV or via REST API.

    • Changing the data read mode from synchronous/asynchronous.

3. User roles

  • Regulations developer/modeler

4. General provisions

  • Already created data structures can only be extended.

  • Tags in the regulation that have already been processed cannot be changed.

5. Registry regulations modeling

5.1. Extensions for data modeling

<databaseChangeLog>
    <changeSet author="..." id="initial creation">
        <ext:createTable name="example_bulk" bulkLoad="false">
             <column name="id" type="UUID" defaultValueComputed="uuid_generate_v4()">
                            <constraints nullable="false" primaryKey="true" primaryKeyName="pk_example_bulk_id"/>
                        </column>
            <column name="first_name" type="text"/>
            ...
            ...
        </ext:createTable>

        <ext:createTable name="example_read_mode" readMode="sync">
             <column name="id" type="UUID" defaultValueComputed="uuid_generate_v4()">
                            <constraints nullable="false" primaryKey="true" primaryKeyName="pk_example_read_mode_id"/>
                        </column>
            <column name="first_name" type="text"/>
            ...
            ...
        </ext:createTable>
    </changeSet>

    <changeSet author="..." id="change api behavior">
        <ext:alterTableApi table="example_bulk">
            <ext:attribute name="bulkLoad" value="true"/>
            <ext:attribute name="readMode" value="sync"/>
        </ext:alterTableApi>

        <ext:alterTableApi table="example_bulk">
            <ext:attribute name="bulkLoad" value="true"/>
        </ext:alterTableApi>
    </changeSet>
</databaseChangeLog>

6. Low-level service design

6.1. Key scenarios

  • When specifying an attribute in a tag, its value is reflected in the metadata table.

  • Processing the tag within multiple changeSets is idempotent.

  • If attributes are not present in the tag, the values in the metadata table remain unchanged.

6.2. XSD validation schema

Specifying the table name and at least one attribute is mandatory.

6.3. Data structure

Table 1. ddm_liquibase_metadata table structure
metadata_id change_type change_name attribute_name attribute_value

%id%

bulkLoad

%table name%

bulkLoad

true/false

%id%

readMode

createTable

%table name%

sync/async

7. High-level development plan

7.1. Technical expertise

  • BE (Java) developer

7.2. Development plan

  • Adding a schema for the new tag to liquibase-ext-schema.

  • Extending liquibase-ddm-ext with the new tag.