Skip to content

Commit

Permalink
[EDP-DDM-33369] Updated arch liquibase docs, added usage references a…
Browse files Browse the repository at this point in the history
…nd translated

Change-Id: Ie8c694bbbce29cab717ca8cc87982531f3d32540
  • Loading branch information
Anton Tuhai committed Oct 18, 2024
1 parent 2770c80 commit ceeeb16
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 235 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
= createTable extension
= _createTable_ extension
include::platform:ROOT:partial$templates/document-attributes/arch-set-en.adoc[]

include::platform:ROOT:partial$admonitions/language-en.adoc[]

== General description
== Overview

The `createTable` tag required for creating tables in the DB is standard for Liquibase, but in *liquibase-ddm-ext*, _Platform_-specific parameters processing is added.
The `createTable` tag, which is required for creating tables in a database, is standard for Liquibase. However, in *liquibase-ddm-ext*, additional parameters specific to the _Platform_ are handled.

== Liquibase scheme
== Liquibase schema

//Зберігається у одній схемі з іншими стандартними тегами Liquibase, у офіційній https://www.liquibase.org/xml/ns/dbchangelog/[документації] (наразі використовується версія 4.15)
It is stored in one scheme with other standard Liquibase tags, in the official https://www.liquibase.org/xml/ns/dbchangelog/[documentation] (currently, version 4.15 is used)

//Атрибути, специфічні для *liquibase-ddm-ext*:
*liquibase-ddm-ext*-specific attributes:
It is stored in the same schema as other standard Liquibase tags, according to the official https://www.liquibase.org/xml/ns/dbchangelog/[documentation] (currently using version 4.15).

Attributes specific to *liquibase-ddm-ext*:
[source, xml]
----
<xsd:attribute name="historyFlag" type="xsd:boolean"/>
Expand All @@ -25,8 +22,8 @@ It is stored in one scheme with other standard Liquibase tags, in the official h
<xsd:attribute name="bulkLoad" type="xsd:boolean"/>
----

//== Приклад використання
== Usage example
== Example usage

[source, xml]
----
<changeSet id="table pd_processing_consent" author="registry owner">
Expand All @@ -47,66 +44,54 @@ It is stored in one scheme with other standard Liquibase tags, in the official h
<column name="person_pass_number" type="TEXT">
<constraints nullable="false"/>
</column>
<column name="auto_generated_number" type="TEXT" ext:autoGenerate="АА-{DDMMYYYY}-{SEQ}">
<column name="auto_generated_number" type="TEXT" ext:autoGenerate="AA-{DDMMYYYY}-{SEQ}">
<constraints nullable="false" unique="true"/>
</column>
</ext:createTable>
</changeSet>
----

//== Опис параметрів
== Parameters description

//Параметри для основного тегу



////
[cols="2,2,6"]
|===
| Назва параметру | Можливі значення | Опис
| *historyFlag* | true | створює для вказаної таблиці відповідну історичну з суфіксом _hst, в яку записуються усі зміни у записах таблиці
| *bulkLoad* | true/false | для модифікації API згенерованих сервісів, визначає, чи буде згенерований ендпоінт, що дозволяє транзакційно зберігати декілька сутностей в одному запиті
| *readMode* | sync/async | для модифікації API згенерованих сервісів, визначає,як буде відбуватись операція читання даних, синхронно чи асинхронно (синхронно - на рівні _registry-rest_api_, асинхронно - шляхом rest-api-> _registry-kafka-api_ -> rest-api)
| *isObject* | true/false | визначає таблицю як об'єкт (додається зв'язок з таблицею _subject_)
|===
////
== Parameter description

Parameters for the main `ext:createTable` tag::
+
[cols="2,2,6"]
|===
| Parameter name | Allowed values | Description
| *historyFlag* | true | for the selected table, this parameter creates a corresponding historical table with _hst suffix, where all table changes are logged
| *bulkLoad* | true/false | defines if the endpoint, which allows for the transactional storing of several entities in one request, will be generated for the modification of generated services API
| *readMode* | sync/async | for the modification of generated services API, defines how the data reading will be performed, synchronously or asynchronously (sync - on the _registry-rest_api_ level, async - via rest-api-> _registry-kafka-api_ -> rest-api)
| *isObject* | true/false | defines a table as an object (connection with the _subject_ table is added)
| Parameter name | Possible values | description
| `historyFlag` | true | Creates a corresponding history table for the specified table with the suffix `_hst`, where all record changes are stored.
| `bulkLoad` | true/false | Modifies the generated service API to determine if a transaction-safe endpoint will be generated, allowing multiple entities to be saved in a single request.
| `isObject` | true/false | Defines the table as an object (adds a link to the _subject_ table).
|===


//Параметри для вкладених тегів *column*



////
+
[TIP]
====
You can find more details about parameter usage on the following pages:
* xref:registry-develop:data-modeling/data/physical-model/liquibase-ddm-ext.adoc#createTable[Table Creation: _historyFlag_]
* xref:registry-develop:data-modeling/data/physical-model/liquibase-ddm-ext.adoc#bulk-load[Attribute _bulkLoad_]
* xref:registry-develop:study-project/study-tasks/task-1-registry-db-modeling.adoc#is-object[Attribute _isObject_]
====

Parameters for nested `column` tags::
+
[cols="2,2,6"]
|===
| Назва атрибуту (name) | Можливі значення (value) | Опис
| *classify* | private/confidential | класифікує дані в колонці як персональні
| *autoGenerate* | Патерн для генерації значень у колонці (наприклад, _АА-{dd-MM-yyyy}-{SEQ}_) | для генерації унікальних значень у колонку за вказаним патерном
| Attribute Name (name) | Possible Values (value) | Description
| `classify` | `private`/`confidential` | Classifies the data in the column as personal.
| `autoGenerate` | Pattern for generating values in the column (e.g., _AA-{dd-MM-yyyy}-{SEQ}_) | Generates unique values in the column according to the specified pattern.
|===
////
+
[TIP]
====
You can find more details about parameter usage on the following pages:
[cols="2,2,6"]
|===
| Attribute name | Allowed values | Description
| *classify* | private/confidential | classifies data in a column as personal
| *autoGenerate* | A pattern for the value generation in a column (for example, _АА-{dd-MM-yyyy}-{SEQ}_) | for the generation of unique values in the column with a defined pattern
|===
* xref:registry-develop:study-project/study-tasks/task-1-registry-db-modeling.adoc#ext-classify[Tag _ext:classify_]
* xref:registry-develop:data-modeling/data/physical-model/auto-generate-number.adoc[]
====

//== Згенеровані запити до БД
== Generated requests to the DB
== Generated database queries

//Запити згенеровані для таблиці, наведеної у прикладі
Requests, generated for the table from the example
The following queries are generated for the table in the example:
[source, sql]
----
CREATE TABLE registry.pd_processing_consent_hst (consent_id UUID NOT NULL, consent_date TIMESTAMP WITH TIME ZONE NOT NULL, person_gender TYPE_GENDER NOT NULL, person_full_name TEXT NOT NULL, person_pass_number TEXT NOT NULL, auto_generated_number TEXT NOT NULL, ddm_created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL, ddm_created_by TEXT NOT NULL, ddm_dml_op CHAR(1) NOT NULL, ddm_system_id UUID NOT NULL, ddm_application_id UUID NOT NULL, ddm_business_process_id UUID, ddm_business_process_definition_id TEXT, ddm_business_process_instance_id TEXT, ddm_business_activity TEXT, ddm_business_activity_instance_id TEXT, ddm_digital_sign TEXT, ddm_digital_sign_derived TEXT, ddm_digital_sign_checksum TEXT, ddm_digital_sign_derived_checksum TEXT, CONSTRAINT pk_pd_processing_consent PRIMARY KEY (consent_id), CONSTRAINT ui_pd_processing_consent_hst UNIQUE (consent_id, ddm_created_at));
Expand All @@ -127,10 +112,9 @@ CREATE SEQUENCE IF NOT EXISTS pd_processing_consent_auto_generated_number_seq IN
GRANT USAGE ON SEQUENCE pd_processing_consent_auto_generated_number_seq TO application_role;
insert into ddm_liquibase_metadata(change_type, change_name, attribute_name, attribute_value) values ('autoGenerate', 'pd_processing_consent', 'auto_generated_number', 'АА-{DDMMYYYY}-{SEQ}');
insert into ddm_liquibase_metadata(change_type, change_name, attribute_name, attribute_value) values ('autoGenerate', 'pd_processing_consent', 'auto_generated_number', 'AA-{DDMMYYYY}-{SEQ}');
insert into ddm_liquibase_metadata(change_type, change_name, attribute_name, attribute_value) values ('bulkLoad', 'pd_processing_consent', 'bulkLoad', 'true');
INSERT INTO public.ddm_db_changelog (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('table pd_processing_consent', 'registry owner', 'main-liquibase.xml', NOW(), 55, '8:1d833a79f2d827609a61ac1df5354bd4', 'createTable tableName=pd_processing_consent', 'CREATE TABLE pd_processing_consent', 'EXECUTED', NULL, NULL, '4.5.0', '7604867906');
----
Loading

0 comments on commit ceeeb16

Please sign in to comment.