diff --git a/CLAUDE.md b/CLAUDE.md index 33e63c4..e42d2d0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -57,6 +57,25 @@ cd tests/sample_models && python models.py then commit the updated snapshot files alongside the code change. +## Fixing bugs + +Aim at the smallest change that fixes the bug. Keep the fix local to the code that is wrong, do +not refactor around it, and do not widen the scope to related cases that are not reported. + +Cover the fix by extending what already exists rather than adding new files: + +- Add the failing construct as a sub-case of an existing sample model, typically + `tests/sample_models/orders/orders.xsd` with matching data in `tests/sample_models/orders/xml/`, + and comment in the XSD what the construct tests. New sample models are for new kinds of schema, + not for single edge cases. +- Add assertions to the existing test module covering that area instead of creating a test file + for one case. The parametrized tests pick up sample models and XML files automatically, so a + construct added to a sample model is exercised by the parsing, round-trip and insertion tests + without new test code. +- Regenerate the snapshots when the data model changes, as described above. + +Check that the bug reproduces before the fix and is gone after it. + ## Writing style - After any code change, check whether docstrings, inline docs, or `docs/` pages need updating and update them as part of the same task. diff --git a/docs/getting_started.md b/docs/getting_started.md index 60d0a9c..829211e 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -51,6 +51,12 @@ xml2db render schema.xsd --format source-tree xml2db render schema.xsd --format ddl --db-type postgresql ``` +!!! note "Documents mixing several schemas" + + `DataModel` reads a single XSD file, but that file can pull in others with `xs:import` (for + another namespace) or `xs:include` (for the same one), so documents mixing several schemas work + as long as one schema describes the whole document. + See [Configuring your data model](configuring.md) for a full description of the available config options. ## Importing XML files diff --git a/docs/how_it_works.md b/docs/how_it_works.md index ffff311..0019f2b 100644 --- a/docs/how_it_works.md +++ b/docs/how_it_works.md @@ -124,6 +124,12 @@ the process much more complex. Whenever a field which would introduce a dependen discarded with a warning, which means that the corresponding data in XML files will not be imported. The rest of the data should be processed correctly. +#### Wildcards + +Wildcards (`xs:any` elements and `xs:anyAttribute` attributes) allow content that the schema does not describe. Schemas +containing them are accepted, but the matching content is not imported and a warning is logged. When the content of such +an element follows a known schema, declaring it explicitly in a wrapper schema makes it importable. + #### Mixed content elements XML elements with mixed content can contain both text and children elements (tags). `xml2db` offers partial support for @@ -132,11 +138,6 @@ text and children elements within a node. When using [`Document.to_xml`](api/document.md#xml2db.document.Document.to_xml), text value will always appear before children elements. -#### Wildcards - -Wildcards (`xs:any` elements and `xs:anyAttribute` attributes) allow content that the schema does not describe. Schemas -containing them are accepted, but the matching content is not imported and a warning is logged. - ## Loading process This section explains in detail how parsing and loading work. Loading an XML file breaks down into the following steps. diff --git a/src/xml2db/model.py b/src/xml2db/model.py index e5a30b0..920db4b 100644 --- a/src/xml2db/model.py +++ b/src/xml2db/model.py @@ -117,6 +117,7 @@ def __init__( self.temp_prefix = str(uuid4())[:8] if temp_prefix is None else temp_prefix self.tables = {} + self.types_keys = {} self.names_types_map = {} self.root_table = None @@ -274,6 +275,40 @@ def _build_model(self): for tb in self.fk_ordered_tables: tb.build_sqlalchemy_tables() + def _get_type_key(self, node) -> str: + """Get the key identifying the XSD type of a node among the data model tables. + + Types are keyed by their local name, which is not unique when a schema imports other schemas: two namespaces + may define different types sharing the same local name. A numeric suffix is appended in this case, so that + each XSD type gets its own table. + + Args: + node: the XSD node whose type key is needed + + Returns: + The key of the type in `self.tables`. + """ + xsd_type = getattr(node, "type", None) + if xsd_type is None: + return self.data_flow_name + if xsd_type in self.types_keys: + return self.types_keys[xsd_type] + key = xsd_type.local_name + if key is None: + key = node.local_name + reserved_keys = set(self.types_keys.values()) + if key in reserved_keys: + i = 1 + while f"{key}_{i}" in reserved_keys: + i += 1 + key = f"{key}_{i}" + logger.warning( + f"two different XSD types share the local name '{xsd_type.local_name or node.local_name}', " + f"the second one is mapped to the table key '{key}'" + ) + self.types_keys[xsd_type] = key + return key + def _parse_tree(self, parent_node: xmlschema.XsdElement, nodes_path: list = None): """Parse a node of an XML schema recursively and create a target data model without any simplification @@ -292,13 +327,7 @@ def _parse_tree(self, parent_node: xmlschema.XsdElement, nodes_path: list = None """ # find current node type and name and returns corresponding table if it already exists - parent_type = ( - parent_node.type.local_name - if hasattr(parent_node, "type") - else self.data_flow_name - ) - if parent_type is None: - parent_type = parent_node.local_name + parent_type = self._get_type_key(parent_node) nodes_path = (nodes_path if nodes_path else []) + [parent_type] @@ -516,7 +545,7 @@ def get_occurs(particle): elif ct.is_complex(): # ignoring recursive definitions by skipping these fields - if child.type.local_name in nodes_path: + if self._get_type_key(child) in nodes_path: logger.warning( f"type '{child.type.local_name}' contains a recursive definition" ) diff --git a/tests/sample_models/orders/base_types.xsd b/tests/sample_models/orders/base_types.xsd index c10a3cd..b468c26 100644 --- a/tests/sample_models/orders/base_types.xsd +++ b/tests/sample_models/orders/base_types.xsd @@ -51,4 +51,12 @@ + + + + + + + \ No newline at end of file diff --git a/tests/sample_models/orders/orders.xsd b/tests/sample_models/orders/orders.xsd index 451f176..912bbe3 100644 --- a/tests/sample_models/orders/orders.xsd +++ b/tests/sample_models/orders/orders.xsd @@ -93,6 +93,17 @@ + + + + + + + + + @@ -101,6 +112,16 @@ + + + + + + + + + + diff --git a/tests/sample_models/orders/orders_ddl_mssql_version0.sql b/tests/sample_models/orders/orders_ddl_mssql_version0.sql index e7c4a05..275829f 100644 --- a/tests/sample_models/orders/orders_ddl_mssql_version0.sql +++ b/tests/sample_models/orders/orders_ddl_mssql_version0.sql @@ -20,6 +20,26 @@ CREATE TABLE orderperson ( ) +CREATE TABLE detail_1 ( + pk_detail_1 INTEGER NOT NULL IDENTITY, + reference VARCHAR(1000) NULL, + carrier VARCHAR(1000) NULL, + record_hash BINARY(20) NULL, + CONSTRAINT cx_pk_detail_1 PRIMARY KEY CLUSTERED (pk_detail_1), + CONSTRAINT detail_1_xml2db_record_hash UNIQUE (record_hash) +) + + +CREATE TABLE detail ( + pk_detail INTEGER NOT NULL IDENTITY, + weight DOUBLE PRECISION NULL, + unit VARCHAR(1000) NULL, + record_hash BINARY(20) NULL, + CONSTRAINT cx_pk_detail PRIMARY KEY CLUSTERED (pk_detail), + CONSTRAINT detail_xml2db_record_hash UNIQUE (record_hash) +) + + CREATE TABLE intfeature_with_peculiarly_long_suffix_which_overflow_max_length ( pk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length INTEGER NOT NULL IDENTITY, id VARCHAR(1000) NULL, @@ -58,6 +78,14 @@ CREATE TABLE item ( ) +CREATE TABLE item_detail ( + fk_item INTEGER NOT NULL, + fk_detail INTEGER NOT NULL, + FOREIGN KEY(fk_item) REFERENCES item (pk_item), + FOREIGN KEY(fk_detail) REFERENCES detail (pk_detail) +) + + CREATE TABLE item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length ( fk_item INTEGER NOT NULL, fk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length INTEGER NOT NULL, @@ -80,6 +108,8 @@ CREATE TABLE shiporder ( processed_at DATETIMEOFFSET NULL, fk_orderperson INTEGER NULL, shipto_fk_orderperson INTEGER NULL, + [carrierId_vat] VARCHAR(1000) NULL, + [carrierId_registry] VARCHAR(1000) NULL, record_hash BINARY(20) NULL, CONSTRAINT cx_pk_shiporder PRIMARY KEY CLUSTERED (pk_shiporder), CONSTRAINT shiporder_xml2db_record_hash UNIQUE (record_hash), @@ -96,6 +126,14 @@ CREATE TABLE shiporder_item ( ) +CREATE TABLE shiporder_detail_detail_1 ( + fk_shiporder INTEGER NOT NULL, + fk_detail_1 INTEGER NOT NULL, + FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder), + FOREIGN KEY(fk_detail_1) REFERENCES detail_1 (pk_detail_1) +) + + CREATE TABLE orders ( pk_orders INTEGER NOT NULL IDENTITY, batch_id VARCHAR(1000) NULL, @@ -114,6 +152,10 @@ CREATE TABLE orders_shiporder ( FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder) ) +CREATE CLUSTERED INDEX ix_fk_item_detail ON item_detail (fk_item, fk_detail) + +CREATE INDEX ix_item_detail_fk_detail ON item_detail (fk_detail) + CREATE CLUSTERED INDEX ix_fk_item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length ON item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length (fk_item, fk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length) CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length_fk_intfeature_with_peculiarly__7aff ON item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length (fk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length) @@ -126,6 +168,10 @@ CREATE CLUSTERED INDEX ix_fk_shiporder_item ON shiporder_item (fk_shiporder, fk_ CREATE INDEX ix_shiporder_item_fk_item ON shiporder_item (fk_item) +CREATE CLUSTERED INDEX ix_fk_shiporder_detail_detail_1 ON shiporder_detail_detail_1 (fk_shiporder, fk_detail_1) + +CREATE INDEX ix_shiporder_detail_detail_1_fk_detail_1 ON shiporder_detail_detail_1 (fk_detail_1) + CREATE CLUSTERED INDEX ix_fk_orders_shiporder ON orders_shiporder (fk_orders, fk_shiporder) CREATE INDEX ix_orders_shiporder_fk_shiporder ON orders_shiporder (fk_shiporder) diff --git a/tests/sample_models/orders/orders_ddl_mssql_version1.sql b/tests/sample_models/orders/orders_ddl_mssql_version1.sql index 51f3837..c07ff1d 100644 --- a/tests/sample_models/orders/orders_ddl_mssql_version1.sql +++ b/tests/sample_models/orders/orders_ddl_mssql_version1.sql @@ -21,6 +21,26 @@ CREATE TABLE orderperson ( ) +CREATE TABLE detail_1 ( + pk_detail_1 INTEGER NOT NULL IDENTITY, + reference VARCHAR(1000) NULL, + carrier VARCHAR(1000) NULL, + record_hash BINARY(16) NULL, + CONSTRAINT cx_pk_detail_1 PRIMARY KEY CLUSTERED (pk_detail_1), + CONSTRAINT detail_1_xml2db_record_hash UNIQUE (record_hash) +) + + +CREATE TABLE detail ( + pk_detail INTEGER NOT NULL IDENTITY, + weight DOUBLE PRECISION NULL, + unit VARCHAR(1000) NULL, + record_hash BINARY(16) NULL, + CONSTRAINT cx_pk_detail PRIMARY KEY CLUSTERED (pk_detail), + CONSTRAINT detail_xml2db_record_hash UNIQUE (record_hash) +) + + CREATE TABLE intfeature_with_peculiarly_long_suffix_which_overflow_max_length ( pk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length INTEGER NOT NULL IDENTITY, id VARCHAR(1000) NULL, @@ -47,6 +67,8 @@ CREATE TABLE shiporder ( processed_at DATETIMEOFFSET NULL, fk_orderperson INTEGER NULL, shipto_fk_orderperson INTEGER NULL, + [carrierId_vat] VARCHAR(1000) NULL, + [carrierId_registry] VARCHAR(1000) NULL, record_hash BINARY(16) NULL, CONSTRAINT cx_pk_shiporder PRIMARY KEY CLUSTERED (pk_shiporder), CONSTRAINT shiporder_xml2db_record_hash UNIQUE (record_hash), @@ -55,6 +77,15 @@ CREATE TABLE shiporder ( ) +CREATE TABLE shiporder_detail_detail_1 ( + fk_shiporder INTEGER NOT NULL, + fk_detail_1 INTEGER NOT NULL, + xml2db_row_number INTEGER NOT NULL, + FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder), + FOREIGN KEY(fk_detail_1) REFERENCES detail_1 (pk_detail_1) +) + + CREATE TABLE orders ( pk_orders INTEGER NOT NULL IDENTITY, batch_id VARCHAR(1000) NULL, @@ -96,6 +127,15 @@ CREATE TABLE item ( ) +CREATE TABLE item_detail ( + fk_item INTEGER NOT NULL, + fk_detail INTEGER NOT NULL, + xml2db_row_number INTEGER NOT NULL, + FOREIGN KEY(fk_item) REFERENCES item (pk_item), + FOREIGN KEY(fk_detail) REFERENCES detail (pk_detail) +) + + CREATE TABLE item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length ( fk_item INTEGER NOT NULL, fk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length INTEGER NOT NULL, @@ -113,10 +153,18 @@ CREATE TABLE item_product_features_stringfeature ( FOREIGN KEY(fk_stringfeature) REFERENCES stringfeature (pk_stringfeature) ) +CREATE CLUSTERED INDEX ix_fk_shiporder_detail_detail_1 ON shiporder_detail_detail_1 (fk_shiporder, fk_detail_1) + +CREATE INDEX ix_shiporder_detail_detail_1_fk_detail_1 ON shiporder_detail_detail_1 (fk_detail_1) + CREATE CLUSTERED INDEX ix_fk_orders_shiporder ON orders_shiporder (fk_orders, fk_shiporder) CREATE INDEX ix_orders_shiporder_fk_shiporder ON orders_shiporder (fk_shiporder) +CREATE CLUSTERED INDEX ix_fk_item_detail ON item_detail (fk_item, fk_detail) + +CREATE INDEX ix_item_detail_fk_detail ON item_detail (fk_detail) + CREATE CLUSTERED INDEX ix_fk_item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length ON item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length (fk_item, fk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length) CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length_fk_intfeature_with_peculiarly__7aff ON item_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length (fk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length) diff --git a/tests/sample_models/orders/orders_ddl_mssql_version2.sql b/tests/sample_models/orders/orders_ddl_mssql_version2.sql index f06326a..6a51408 100644 --- a/tests/sample_models/orders/orders_ddl_mssql_version2.sql +++ b/tests/sample_models/orders/orders_ddl_mssql_version2.sql @@ -31,6 +31,26 @@ CREATE TABLE orderperson ( ) +CREATE TABLE detail_1 ( + pk_detail_1 INTEGER NOT NULL IDENTITY, + reference VARCHAR(1000) NULL, + carrier VARCHAR(1000) NULL, + xml2db_record_hash BINARY(20) NULL, + CONSTRAINT cx_pk_detail_1 PRIMARY KEY CLUSTERED (pk_detail_1), + CONSTRAINT detail_1_xml2db_record_hash UNIQUE (xml2db_record_hash) +) + + +CREATE TABLE detail ( + pk_detail INTEGER NOT NULL IDENTITY, + weight DOUBLE PRECISION NULL, + unit VARCHAR(1000) NULL, + xml2db_record_hash BINARY(20) NULL, + CONSTRAINT cx_pk_detail PRIMARY KEY CLUSTERED (pk_detail), + CONSTRAINT detail_xml2db_record_hash UNIQUE (xml2db_record_hash) +) + + CREATE TABLE intfeature_with_peculiarly_long_suffix_which_overflow_max_length ( pk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length INTEGER NOT NULL IDENTITY, id VARCHAR(1000) NULL, @@ -95,6 +115,14 @@ CREATE TABLE item ( ) +CREATE TABLE item_detail ( + fk_item INTEGER NOT NULL, + fk_detail INTEGER NOT NULL, + FOREIGN KEY(fk_item) REFERENCES item (pk_item), + FOREIGN KEY(fk_detail) REFERENCES detail (pk_detail) +) + + CREATE TABLE shiporder ( pk_shiporder INTEGER NOT NULL IDENTITY, temp_pk_shiporder INTEGER NULL, @@ -115,6 +143,8 @@ CREATE TABLE shiporder ( orderperson_coordinates VARCHAR(1000) NULL, orderperson_a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length VARCHAR(1000) NULL, shipto_fk_orderperson INTEGER NULL, + [carrierId_vat] VARCHAR(1000) NULL, + [carrierId_registry] VARCHAR(1000) NULL, CONSTRAINT cx_pk_shiporder PRIMARY KEY CLUSTERED (pk_shiporder), FOREIGN KEY(fk_parent_orders) REFERENCES orders (pk_orders), FOREIGN KEY(shipto_fk_orderperson) REFERENCES orderperson (pk_orderperson) @@ -128,6 +158,14 @@ CREATE TABLE shiporder_item ( FOREIGN KEY(fk_item) REFERENCES item (pk_item) ) + +CREATE TABLE shiporder_detail_detail_1 ( + fk_shiporder INTEGER NOT NULL, + fk_detail_1 INTEGER NOT NULL, + FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder), + FOREIGN KEY(fk_detail_1) REFERENCES detail_1 (pk_detail_1) +) + CREATE CLUSTERED INDEX ix_fk_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length ON product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length (fk_product, fk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length) CREATE INDEX ix_product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length_fk_intfeature_with_peculiarly_long__3ab3 ON product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length (fk_intfeature_with_peculiarly_long_suffix_which_overflow_max_length) @@ -136,7 +174,15 @@ CREATE CLUSTERED INDEX ix_fk_product_features_stringfeature ON product_features_ CREATE INDEX ix_product_features_stringfeature_fk_stringfeature ON product_features_stringfeature (fk_stringfeature) +CREATE CLUSTERED INDEX ix_fk_item_detail ON item_detail (fk_item, fk_detail) + +CREATE INDEX ix_item_detail_fk_detail ON item_detail (fk_detail) + CREATE CLUSTERED INDEX ix_fk_shiporder_item ON shiporder_item (fk_shiporder, fk_item) CREATE INDEX ix_shiporder_item_fk_item ON shiporder_item (fk_item) +CREATE CLUSTERED INDEX ix_fk_shiporder_detail_detail_1 ON shiporder_detail_detail_1 (fk_shiporder, fk_detail_1) + +CREATE INDEX ix_shiporder_detail_detail_1_fk_detail_1 ON shiporder_detail_detail_1 (fk_detail_1) + diff --git a/tests/sample_models/orders/orders_ddl_mysql_version0.sql b/tests/sample_models/orders/orders_ddl_mysql_version0.sql index 6da9028..bf5f96c 100644 --- a/tests/sample_models/orders/orders_ddl_mysql_version0.sql +++ b/tests/sample_models/orders/orders_ddl_mysql_version0.sql @@ -20,6 +20,26 @@ CREATE TABLE orderperson ( ) +CREATE TABLE detail_1 ( + pk_detail_1 INTEGER NOT NULL AUTO_INCREMENT, + reference VARCHAR(255), + carrier VARCHAR(255), + record_hash BINARY(20), + CONSTRAINT cx_pk_detail_1 PRIMARY KEY (pk_detail_1), + CONSTRAINT detail_1_xml2db_record_hash UNIQUE (record_hash) +) + + +CREATE TABLE detail ( + pk_detail INTEGER NOT NULL AUTO_INCREMENT, + weight DOUBLE, + unit VARCHAR(255), + record_hash BINARY(20), + CONSTRAINT cx_pk_detail PRIMARY KEY (pk_detail), + CONSTRAINT detail_xml2db_record_hash UNIQUE (record_hash) +) + + CREATE TABLE intfeature_with_peculiarly_long_suffix_which_ove_5868736 ( pk_intfeature_with_peculiarly_long_suffix_which__85b659b INTEGER NOT NULL AUTO_INCREMENT, id VARCHAR(255), @@ -58,6 +78,14 @@ CREATE TABLE item ( ) +CREATE TABLE item_detail ( + fk_item INTEGER NOT NULL, + fk_detail INTEGER NOT NULL, + FOREIGN KEY(fk_item) REFERENCES item (pk_item), + FOREIGN KEY(fk_detail) REFERENCES detail (pk_detail) +) + + CREATE TABLE item_product_features_intfeature_with_peculiarly_779d1ac ( fk_item INTEGER NOT NULL, fk_intfeature_with_peculiarly_long_suffix_which__00590e9 INTEGER NOT NULL, @@ -80,6 +108,8 @@ CREATE TABLE shiporder ( processed_at DATETIME, fk_orderperson INTEGER, shipto_fk_orderperson INTEGER, + `carrierId_vat` VARCHAR(255), + `carrierId_registry` VARCHAR(255), record_hash BINARY(20), CONSTRAINT cx_pk_shiporder PRIMARY KEY (pk_shiporder), CONSTRAINT shiporder_xml2db_record_hash UNIQUE (record_hash), @@ -96,6 +126,14 @@ CREATE TABLE shiporder_item ( ) +CREATE TABLE shiporder_detail_detail_1 ( + fk_shiporder INTEGER NOT NULL, + fk_detail_1 INTEGER NOT NULL, + FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder), + FOREIGN KEY(fk_detail_1) REFERENCES detail_1 (pk_detail_1) +) + + CREATE TABLE orders ( pk_orders INTEGER NOT NULL AUTO_INCREMENT, batch_id VARCHAR(255), @@ -114,6 +152,10 @@ CREATE TABLE orders_shiporder ( FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder) ) +CREATE INDEX ix_item_detail_fk_detail ON item_detail (fk_detail) + +CREATE INDEX ix_item_detail_fk_item ON item_detail (fk_item) + CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_779d_b099 ON item_product_features_intfeature_with_peculiarly_779d1ac (fk_intfeature_with_peculiarly_long_suffix_which__00590e9) CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_779d_4520 ON item_product_features_intfeature_with_peculiarly_779d1ac (fk_item) @@ -126,6 +168,10 @@ CREATE INDEX ix_shiporder_item_fk_item ON shiporder_item (fk_item) CREATE INDEX ix_shiporder_item_fk_shiporder ON shiporder_item (fk_shiporder) +CREATE INDEX ix_shiporder_detail_detail_1_fk_detail_1 ON shiporder_detail_detail_1 (fk_detail_1) + +CREATE INDEX ix_shiporder_detail_detail_1_fk_shiporder ON shiporder_detail_detail_1 (fk_shiporder) + CREATE INDEX ix_orders_shiporder_fk_orders ON orders_shiporder (fk_orders) CREATE INDEX ix_orders_shiporder_fk_shiporder ON orders_shiporder (fk_shiporder) diff --git a/tests/sample_models/orders/orders_ddl_mysql_version1.sql b/tests/sample_models/orders/orders_ddl_mysql_version1.sql index 8a381d3..ed0f1fe 100644 --- a/tests/sample_models/orders/orders_ddl_mysql_version1.sql +++ b/tests/sample_models/orders/orders_ddl_mysql_version1.sql @@ -21,6 +21,26 @@ CREATE TABLE orderperson ( ) +CREATE TABLE detail_1 ( + pk_detail_1 INTEGER NOT NULL AUTO_INCREMENT, + reference VARCHAR(255), + carrier VARCHAR(255), + record_hash BINARY(16), + CONSTRAINT cx_pk_detail_1 PRIMARY KEY (pk_detail_1), + CONSTRAINT detail_1_xml2db_record_hash UNIQUE (record_hash) +) + + +CREATE TABLE detail ( + pk_detail INTEGER NOT NULL AUTO_INCREMENT, + weight DOUBLE, + unit VARCHAR(255), + record_hash BINARY(16), + CONSTRAINT cx_pk_detail PRIMARY KEY (pk_detail), + CONSTRAINT detail_xml2db_record_hash UNIQUE (record_hash) +) + + CREATE TABLE intfeature_with_peculiarly_long_suffix_which_ove_5868736 ( pk_intfeature_with_peculiarly_long_suffix_which__85b659b INTEGER NOT NULL AUTO_INCREMENT, id VARCHAR(255), @@ -47,6 +67,8 @@ CREATE TABLE shiporder ( processed_at DATETIME, fk_orderperson INTEGER, shipto_fk_orderperson INTEGER, + `carrierId_vat` VARCHAR(255), + `carrierId_registry` VARCHAR(255), record_hash BINARY(16), CONSTRAINT cx_pk_shiporder PRIMARY KEY (pk_shiporder), CONSTRAINT shiporder_xml2db_record_hash UNIQUE (record_hash), @@ -55,6 +77,15 @@ CREATE TABLE shiporder ( ) +CREATE TABLE shiporder_detail_detail_1 ( + fk_shiporder INTEGER NOT NULL, + fk_detail_1 INTEGER NOT NULL, + xml2db_row_number INTEGER NOT NULL, + FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder), + FOREIGN KEY(fk_detail_1) REFERENCES detail_1 (pk_detail_1) +) + + CREATE TABLE orders ( pk_orders INTEGER NOT NULL AUTO_INCREMENT, batch_id VARCHAR(255), @@ -96,6 +127,15 @@ CREATE TABLE item ( ) +CREATE TABLE item_detail ( + fk_item INTEGER NOT NULL, + fk_detail INTEGER NOT NULL, + xml2db_row_number INTEGER NOT NULL, + FOREIGN KEY(fk_item) REFERENCES item (pk_item), + FOREIGN KEY(fk_detail) REFERENCES detail (pk_detail) +) + + CREATE TABLE item_product_features_intfeature_with_peculiarly_779d1ac ( fk_item INTEGER NOT NULL, fk_intfeature_with_peculiarly_long_suffix_which__00590e9 INTEGER NOT NULL, @@ -113,10 +153,18 @@ CREATE TABLE item_product_features_stringfeature ( FOREIGN KEY(fk_stringfeature) REFERENCES stringfeature (pk_stringfeature) ) +CREATE INDEX ix_shiporder_detail_detail_1_fk_detail_1 ON shiporder_detail_detail_1 (fk_detail_1) + +CREATE INDEX ix_shiporder_detail_detail_1_fk_shiporder ON shiporder_detail_detail_1 (fk_shiporder) + CREATE INDEX ix_orders_shiporder_fk_orders ON orders_shiporder (fk_orders) CREATE INDEX ix_orders_shiporder_fk_shiporder ON orders_shiporder (fk_shiporder) +CREATE INDEX ix_item_detail_fk_detail ON item_detail (fk_detail) + +CREATE INDEX ix_item_detail_fk_item ON item_detail (fk_item) + CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_779d_b099 ON item_product_features_intfeature_with_peculiarly_779d1ac (fk_intfeature_with_peculiarly_long_suffix_which__00590e9) CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_779d_4520 ON item_product_features_intfeature_with_peculiarly_779d1ac (fk_item) diff --git a/tests/sample_models/orders/orders_ddl_mysql_version2.sql b/tests/sample_models/orders/orders_ddl_mysql_version2.sql index e8d17d9..0ad69c4 100644 --- a/tests/sample_models/orders/orders_ddl_mysql_version2.sql +++ b/tests/sample_models/orders/orders_ddl_mysql_version2.sql @@ -31,6 +31,26 @@ CREATE TABLE orderperson ( ) +CREATE TABLE detail_1 ( + pk_detail_1 INTEGER NOT NULL AUTO_INCREMENT, + reference VARCHAR(255), + carrier VARCHAR(255), + xml2db_record_hash BINARY(20), + CONSTRAINT cx_pk_detail_1 PRIMARY KEY (pk_detail_1), + CONSTRAINT detail_1_xml2db_record_hash UNIQUE (xml2db_record_hash) +) + + +CREATE TABLE detail ( + pk_detail INTEGER NOT NULL AUTO_INCREMENT, + weight DOUBLE, + unit VARCHAR(255), + xml2db_record_hash BINARY(20), + CONSTRAINT cx_pk_detail PRIMARY KEY (pk_detail), + CONSTRAINT detail_xml2db_record_hash UNIQUE (xml2db_record_hash) +) + + CREATE TABLE intfeature_with_peculiarly_long_suffix_which_ove_5868736 ( pk_intfeature_with_peculiarly_long_suffix_which__85b659b INTEGER NOT NULL AUTO_INCREMENT, id VARCHAR(255), @@ -95,6 +115,14 @@ CREATE TABLE item ( ) +CREATE TABLE item_detail ( + fk_item INTEGER NOT NULL, + fk_detail INTEGER NOT NULL, + FOREIGN KEY(fk_item) REFERENCES item (pk_item), + FOREIGN KEY(fk_detail) REFERENCES detail (pk_detail) +) + + CREATE TABLE shiporder ( pk_shiporder INTEGER NOT NULL AUTO_INCREMENT, temp_pk_shiporder INTEGER, @@ -115,6 +143,8 @@ CREATE TABLE shiporder ( orderperson_coordinates VARCHAR(255), orderperson_a_very_long_field_type_that_makes_co_ee3c2ee VARCHAR(255), shipto_fk_orderperson INTEGER, + `carrierId_vat` VARCHAR(255), + `carrierId_registry` VARCHAR(255), CONSTRAINT cx_pk_shiporder PRIMARY KEY (pk_shiporder), FOREIGN KEY(fk_parent_orders) REFERENCES orders (pk_orders), FOREIGN KEY(shipto_fk_orderperson) REFERENCES orderperson (pk_orderperson) @@ -128,6 +158,14 @@ CREATE TABLE shiporder_item ( FOREIGN KEY(fk_item) REFERENCES item (pk_item) ) + +CREATE TABLE shiporder_detail_detail_1 ( + fk_shiporder INTEGER NOT NULL, + fk_detail_1 INTEGER NOT NULL, + FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder), + FOREIGN KEY(fk_detail_1) REFERENCES detail_1 (pk_detail_1) +) + CREATE INDEX ix_product_features_intfeature_with_peculiarly_long_82a4_da9b ON product_features_intfeature_with_peculiarly_long_82a4847 (fk_intfeature_with_peculiarly_long_suffix_which__00590e9) CREATE INDEX ix_product_features_intfeature_with_peculiarly_long_82a4_6910 ON product_features_intfeature_with_peculiarly_long_82a4847 (fk_product) @@ -136,7 +174,15 @@ CREATE INDEX ix_product_features_stringfeature_fk_product ON product_features_st CREATE INDEX ix_product_features_stringfeature_fk_stringfeature ON product_features_stringfeature (fk_stringfeature) +CREATE INDEX ix_item_detail_fk_detail ON item_detail (fk_detail) + +CREATE INDEX ix_item_detail_fk_item ON item_detail (fk_item) + CREATE INDEX ix_shiporder_item_fk_item ON shiporder_item (fk_item) CREATE INDEX ix_shiporder_item_fk_shiporder ON shiporder_item (fk_shiporder) +CREATE INDEX ix_shiporder_detail_detail_1_fk_detail_1 ON shiporder_detail_detail_1 (fk_detail_1) + +CREATE INDEX ix_shiporder_detail_detail_1_fk_shiporder ON shiporder_detail_detail_1 (fk_shiporder) + diff --git a/tests/sample_models/orders/orders_ddl_postgresql_version0.sql b/tests/sample_models/orders/orders_ddl_postgresql_version0.sql index fdbd56c..7e16662 100644 --- a/tests/sample_models/orders/orders_ddl_postgresql_version0.sql +++ b/tests/sample_models/orders/orders_ddl_postgresql_version0.sql @@ -20,6 +20,26 @@ CREATE TABLE orderperson ( ) +CREATE TABLE detail_1 ( + pk_detail_1 SERIAL NOT NULL, + reference VARCHAR(1000), + carrier VARCHAR(1000), + record_hash BYTEA, + CONSTRAINT cx_pk_detail_1 PRIMARY KEY (pk_detail_1), + CONSTRAINT detail_1_xml2db_record_hash UNIQUE (record_hash) +) + + +CREATE TABLE detail ( + pk_detail SERIAL NOT NULL, + weight DOUBLE PRECISION, + unit VARCHAR(1000), + record_hash BYTEA, + CONSTRAINT cx_pk_detail PRIMARY KEY (pk_detail), + CONSTRAINT detail_xml2db_record_hash UNIQUE (record_hash) +) + + CREATE TABLE intfeature_with_peculiarly_long_suffix_which_overflow_m_5868736 ( pk_intfeature_with_peculiarly_long_suffix_which_overflo_85b659b SERIAL NOT NULL, id VARCHAR(1000), @@ -58,6 +78,14 @@ CREATE TABLE item ( ) +CREATE TABLE item_detail ( + fk_item INTEGER NOT NULL, + fk_detail INTEGER NOT NULL, + FOREIGN KEY(fk_item) REFERENCES item (pk_item), + FOREIGN KEY(fk_detail) REFERENCES detail (pk_detail) +) + + CREATE TABLE item_product_features_intfeature_with_peculiarly_long_s_779d1ac ( fk_item INTEGER NOT NULL, fk_intfeature_with_peculiarly_long_suffix_which_overflo_00590e9 INTEGER NOT NULL, @@ -80,6 +108,8 @@ CREATE TABLE shiporder ( processed_at TIMESTAMP WITH TIME ZONE, fk_orderperson INTEGER, shipto_fk_orderperson INTEGER, + "carrierId_vat" VARCHAR(1000), + "carrierId_registry" VARCHAR(1000), record_hash BYTEA, CONSTRAINT cx_pk_shiporder PRIMARY KEY (pk_shiporder), CONSTRAINT shiporder_xml2db_record_hash UNIQUE (record_hash), @@ -96,6 +126,14 @@ CREATE TABLE shiporder_item ( ) +CREATE TABLE shiporder_detail_detail_1 ( + fk_shiporder INTEGER NOT NULL, + fk_detail_1 INTEGER NOT NULL, + FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder), + FOREIGN KEY(fk_detail_1) REFERENCES detail_1 (pk_detail_1) +) + + CREATE TABLE orders ( pk_orders SERIAL NOT NULL, batch_id VARCHAR(1000), @@ -114,6 +152,10 @@ CREATE TABLE orders_shiporder ( FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder) ) +CREATE INDEX ix_item_detail_fk_detail ON item_detail (fk_detail) + +CREATE INDEX ix_item_detail_fk_item ON item_detail (fk_item) + CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_lon_36ea ON item_product_features_intfeature_with_peculiarly_long_s_779d1ac (fk_intfeature_with_peculiarly_long_suffix_which_overflo_00590e9) CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_lon_124e ON item_product_features_intfeature_with_peculiarly_long_s_779d1ac (fk_item) @@ -126,6 +168,10 @@ CREATE INDEX ix_shiporder_item_fk_item ON shiporder_item (fk_item) CREATE INDEX ix_shiporder_item_fk_shiporder ON shiporder_item (fk_shiporder) +CREATE INDEX ix_shiporder_detail_detail_1_fk_detail_1 ON shiporder_detail_detail_1 (fk_detail_1) + +CREATE INDEX ix_shiporder_detail_detail_1_fk_shiporder ON shiporder_detail_detail_1 (fk_shiporder) + CREATE INDEX ix_orders_shiporder_fk_orders ON orders_shiporder (fk_orders) CREATE INDEX ix_orders_shiporder_fk_shiporder ON orders_shiporder (fk_shiporder) diff --git a/tests/sample_models/orders/orders_ddl_postgresql_version1.sql b/tests/sample_models/orders/orders_ddl_postgresql_version1.sql index 03dce19..ddc317c 100644 --- a/tests/sample_models/orders/orders_ddl_postgresql_version1.sql +++ b/tests/sample_models/orders/orders_ddl_postgresql_version1.sql @@ -21,6 +21,26 @@ CREATE TABLE orderperson ( ) +CREATE TABLE detail_1 ( + pk_detail_1 SERIAL NOT NULL, + reference VARCHAR(1000), + carrier VARCHAR(1000), + record_hash BYTEA, + CONSTRAINT cx_pk_detail_1 PRIMARY KEY (pk_detail_1), + CONSTRAINT detail_1_xml2db_record_hash UNIQUE (record_hash) +) + + +CREATE TABLE detail ( + pk_detail SERIAL NOT NULL, + weight DOUBLE PRECISION, + unit VARCHAR(1000), + record_hash BYTEA, + CONSTRAINT cx_pk_detail PRIMARY KEY (pk_detail), + CONSTRAINT detail_xml2db_record_hash UNIQUE (record_hash) +) + + CREATE TABLE intfeature_with_peculiarly_long_suffix_which_overflow_m_5868736 ( pk_intfeature_with_peculiarly_long_suffix_which_overflo_85b659b SERIAL NOT NULL, id VARCHAR(1000), @@ -47,6 +67,8 @@ CREATE TABLE shiporder ( processed_at TIMESTAMP WITH TIME ZONE, fk_orderperson INTEGER, shipto_fk_orderperson INTEGER, + "carrierId_vat" VARCHAR(1000), + "carrierId_registry" VARCHAR(1000), record_hash BYTEA, CONSTRAINT cx_pk_shiporder PRIMARY KEY (pk_shiporder), CONSTRAINT shiporder_xml2db_record_hash UNIQUE (record_hash), @@ -55,6 +77,15 @@ CREATE TABLE shiporder ( ) +CREATE TABLE shiporder_detail_detail_1 ( + fk_shiporder INTEGER NOT NULL, + fk_detail_1 INTEGER NOT NULL, + xml2db_row_number INTEGER NOT NULL, + FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder), + FOREIGN KEY(fk_detail_1) REFERENCES detail_1 (pk_detail_1) +) + + CREATE TABLE orders ( pk_orders SERIAL NOT NULL, batch_id VARCHAR(1000), @@ -96,6 +127,15 @@ CREATE TABLE item ( ) +CREATE TABLE item_detail ( + fk_item INTEGER NOT NULL, + fk_detail INTEGER NOT NULL, + xml2db_row_number INTEGER NOT NULL, + FOREIGN KEY(fk_item) REFERENCES item (pk_item), + FOREIGN KEY(fk_detail) REFERENCES detail (pk_detail) +) + + CREATE TABLE item_product_features_intfeature_with_peculiarly_long_s_779d1ac ( fk_item INTEGER NOT NULL, fk_intfeature_with_peculiarly_long_suffix_which_overflo_00590e9 INTEGER NOT NULL, @@ -113,10 +153,18 @@ CREATE TABLE item_product_features_stringfeature ( FOREIGN KEY(fk_stringfeature) REFERENCES stringfeature (pk_stringfeature) ) +CREATE INDEX ix_shiporder_detail_detail_1_fk_detail_1 ON shiporder_detail_detail_1 (fk_detail_1) + +CREATE INDEX ix_shiporder_detail_detail_1_fk_shiporder ON shiporder_detail_detail_1 (fk_shiporder) + CREATE INDEX ix_orders_shiporder_fk_orders ON orders_shiporder (fk_orders) CREATE INDEX ix_orders_shiporder_fk_shiporder ON orders_shiporder (fk_shiporder) +CREATE INDEX ix_item_detail_fk_detail ON item_detail (fk_detail) + +CREATE INDEX ix_item_detail_fk_item ON item_detail (fk_item) + CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_lon_36ea ON item_product_features_intfeature_with_peculiarly_long_s_779d1ac (fk_intfeature_with_peculiarly_long_suffix_which_overflo_00590e9) CREATE INDEX ix_item_product_features_intfeature_with_peculiarly_lon_124e ON item_product_features_intfeature_with_peculiarly_long_s_779d1ac (fk_item) diff --git a/tests/sample_models/orders/orders_ddl_postgresql_version2.sql b/tests/sample_models/orders/orders_ddl_postgresql_version2.sql index 4ad1cd1..d05dd75 100644 --- a/tests/sample_models/orders/orders_ddl_postgresql_version2.sql +++ b/tests/sample_models/orders/orders_ddl_postgresql_version2.sql @@ -31,6 +31,26 @@ CREATE TABLE orderperson ( ) +CREATE TABLE detail_1 ( + pk_detail_1 SERIAL NOT NULL, + reference VARCHAR(1000), + carrier VARCHAR(1000), + xml2db_record_hash BYTEA, + CONSTRAINT cx_pk_detail_1 PRIMARY KEY (pk_detail_1), + CONSTRAINT detail_1_xml2db_record_hash UNIQUE (xml2db_record_hash) +) + + +CREATE TABLE detail ( + pk_detail SERIAL NOT NULL, + weight DOUBLE PRECISION, + unit VARCHAR(1000), + xml2db_record_hash BYTEA, + CONSTRAINT cx_pk_detail PRIMARY KEY (pk_detail), + CONSTRAINT detail_xml2db_record_hash UNIQUE (xml2db_record_hash) +) + + CREATE TABLE intfeature_with_peculiarly_long_suffix_which_overflow_m_5868736 ( pk_intfeature_with_peculiarly_long_suffix_which_overflo_85b659b SERIAL NOT NULL, id VARCHAR(1000), @@ -95,6 +115,14 @@ CREATE TABLE item ( ) +CREATE TABLE item_detail ( + fk_item INTEGER NOT NULL, + fk_detail INTEGER NOT NULL, + FOREIGN KEY(fk_item) REFERENCES item (pk_item), + FOREIGN KEY(fk_detail) REFERENCES detail (pk_detail) +) + + CREATE TABLE shiporder ( pk_shiporder SERIAL NOT NULL, temp_pk_shiporder INTEGER, @@ -115,6 +143,8 @@ CREATE TABLE shiporder ( orderperson_coordinates VARCHAR(1000), orderperson_a_very_long_field_type_that_makes_col_name__ee3c2ee VARCHAR(1000), shipto_fk_orderperson INTEGER, + "carrierId_vat" VARCHAR(1000), + "carrierId_registry" VARCHAR(1000), CONSTRAINT cx_pk_shiporder PRIMARY KEY (pk_shiporder), FOREIGN KEY(fk_parent_orders) REFERENCES orders (pk_orders), FOREIGN KEY(shipto_fk_orderperson) REFERENCES orderperson (pk_orderperson) @@ -128,6 +158,14 @@ CREATE TABLE shiporder_item ( FOREIGN KEY(fk_item) REFERENCES item (pk_item) ) + +CREATE TABLE shiporder_detail_detail_1 ( + fk_shiporder INTEGER NOT NULL, + fk_detail_1 INTEGER NOT NULL, + FOREIGN KEY(fk_shiporder) REFERENCES shiporder (pk_shiporder), + FOREIGN KEY(fk_detail_1) REFERENCES detail_1 (pk_detail_1) +) + CREATE INDEX ix_product_features_intfeature_with_peculiarly_long_suf_63f4 ON product_features_intfeature_with_peculiarly_long_suffix_82a4847 (fk_intfeature_with_peculiarly_long_suffix_which_overflo_00590e9) CREATE INDEX ix_product_features_intfeature_with_peculiarly_long_suf_0375 ON product_features_intfeature_with_peculiarly_long_suffix_82a4847 (fk_product) @@ -136,7 +174,15 @@ CREATE INDEX ix_product_features_stringfeature_fk_product ON product_features_st CREATE INDEX ix_product_features_stringfeature_fk_stringfeature ON product_features_stringfeature (fk_stringfeature) +CREATE INDEX ix_item_detail_fk_detail ON item_detail (fk_detail) + +CREATE INDEX ix_item_detail_fk_item ON item_detail (fk_item) + CREATE INDEX ix_shiporder_item_fk_item ON shiporder_item (fk_item) CREATE INDEX ix_shiporder_item_fk_shiporder ON shiporder_item (fk_shiporder) +CREATE INDEX ix_shiporder_detail_detail_1_fk_detail_1 ON shiporder_detail_detail_1 (fk_detail_1) + +CREATE INDEX ix_shiporder_detail_detail_1_fk_shiporder ON shiporder_detail_detail_1 (fk_shiporder) + diff --git a/tests/sample_models/orders/orders_erd_version0.md b/tests/sample_models/orders/orders_erd_version0.md index c3c803b..0008dd2 100644 --- a/tests/sample_models/orders/orders_erd_version0.md +++ b/tests/sample_models/orders/orders_erd_version0.md @@ -8,12 +8,16 @@ erDiagram shiporder ||--|| orderperson : "orderperson" shiporder ||--o| orderperson : "shipto" shiporder ||--|{ item : "item*" + shiporder ||--o{ detail_1 : "detail*" shiporder { string orderid dateTime processed_at + string carrierId_vat + string carrierId_registry } item ||--o| orderperson : "delivery_from" item ||--o| orderperson : "delivery_to" + item ||--o{ detail : "detail*" item ||--o{ intfeature_with_peculiarly_long_suffix_which_overflow_max_length : "product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length*" item ||--o{ stringfeature : "product_features_stringfeature*" item { @@ -32,6 +36,14 @@ erDiagram string id integer value } + detail { + decimal weight + string unit + } + detail_1 { + string reference + string carrier + } orderperson { string name_attr string name diff --git a/tests/sample_models/orders/orders_erd_version1.md b/tests/sample_models/orders/orders_erd_version1.md index 2b44020..dee3be0 100644 --- a/tests/sample_models/orders/orders_erd_version1.md +++ b/tests/sample_models/orders/orders_erd_version1.md @@ -2,6 +2,7 @@ erDiagram item ||--o| orderperson : "delivery_from" item ||--o| orderperson : "delivery_to" + item ||--o{ detail : "detail*" item ||--o{ intfeature_with_peculiarly_long_suffix_which_overflow_max_length : "product_features_intfeature_with_peculiarly_long_suffix_which_overflow_max_length*" item ||--o{ stringfeature : "product_features_stringfeature*" item { @@ -20,9 +21,12 @@ erDiagram shiporder ||--|| orderperson : "orderperson" shiporder ||--o| orderperson : "shipto" shiporder ||--|{ item : "item" + shiporder ||--o{ detail_1 : "detail*" shiporder { string orderid dateTime processed_at + string carrierId_vat + string carrierId_registry } stringfeature { string id @@ -32,6 +36,14 @@ erDiagram string id integer value } + detail { + decimal weight + string unit + } + detail_1 { + string reference + string carrier + } orderperson { string name_attr string name diff --git a/tests/sample_models/orders/orders_erd_version2.md b/tests/sample_models/orders/orders_erd_version2.md index fba046e..002b10f 100644 --- a/tests/sample_models/orders/orders_erd_version2.md +++ b/tests/sample_models/orders/orders_erd_version2.md @@ -2,6 +2,7 @@ erDiagram shiporder ||--o| orderperson : "shipto" shiporder ||--|{ item : "item*" + shiporder ||--o{ detail_1 : "detail*" shiporder { string orderid dateTime processed_at @@ -18,10 +19,13 @@ erDiagram string orderperson_companyId_value string orderperson_coordinates string orderperson_a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length + string carrierId_vat + string carrierId_registry } item ||--|| product : "product" item ||--o| orderperson : "delivery_from" item ||--o| orderperson : "delivery_to" + item ||--o{ detail : "detail*" item { string note integer quantity @@ -42,6 +46,14 @@ erDiagram string id integer value } + detail { + decimal weight + string unit + } + detail_1 { + string reference + string carrier + } orderperson { string name_attr string name diff --git a/tests/sample_models/orders/orders_source_tree_version0.txt b/tests/sample_models/orders/orders_source_tree_version0.txt index 5563bcf..44b3b86 100644 --- a/tests/sample_models/orders/orders_source_tree_version0.txt +++ b/tests/sample_models/orders/orders_source_tree_version0.txt @@ -92,4 +92,13 @@ orders: lei[0, 1]: string coordinates[0, 1]: string extra[0, 1]: - a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string \ No newline at end of file + a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string + detail[0, None]: + weight[1, 1]: decimal + unit[1, 1]: string + detail[0, None]: + reference[1, 1]: string + carrier[1, 1]: string + carrierId[0, 1]: + vat[1, 1]: string + registry[1, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_source_tree_version1.txt b/tests/sample_models/orders/orders_source_tree_version1.txt index 5563bcf..44b3b86 100644 --- a/tests/sample_models/orders/orders_source_tree_version1.txt +++ b/tests/sample_models/orders/orders_source_tree_version1.txt @@ -92,4 +92,13 @@ orders: lei[0, 1]: string coordinates[0, 1]: string extra[0, 1]: - a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string \ No newline at end of file + a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string + detail[0, None]: + weight[1, 1]: decimal + unit[1, 1]: string + detail[0, None]: + reference[1, 1]: string + carrier[1, 1]: string + carrierId[0, 1]: + vat[1, 1]: string + registry[1, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_source_tree_version2.txt b/tests/sample_models/orders/orders_source_tree_version2.txt index 5563bcf..44b3b86 100644 --- a/tests/sample_models/orders/orders_source_tree_version2.txt +++ b/tests/sample_models/orders/orders_source_tree_version2.txt @@ -92,4 +92,13 @@ orders: lei[0, 1]: string coordinates[0, 1]: string extra[0, 1]: - a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string \ No newline at end of file + a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string + detail[0, None]: + weight[1, 1]: decimal + unit[1, 1]: string + detail[0, None]: + reference[1, 1]: string + carrier[1, 1]: string + carrierId[0, 1]: + vat[1, 1]: string + registry[1, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_target_tree_version0.txt b/tests/sample_models/orders/orders_target_tree_version0.txt index 9e46c7f..06ca732 100644 --- a/tests/sample_models/orders/orders_target_tree_version0.txt +++ b/tests/sample_models/orders/orders_target_tree_version0.txt @@ -72,4 +72,12 @@ orders: companyId_type[0, 1]: string companyId_value[0, 1]: string coordinates[0, 1]: string - a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string \ No newline at end of file + a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string + detail[0, None]: + weight[1, 1]: decimal + unit[1, 1]: string + detail[0, None]: + reference[1, 1]: string + carrier[1, 1]: string + carrierId_vat[0, 1]: string + carrierId_registry[0, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_target_tree_version1.txt b/tests/sample_models/orders/orders_target_tree_version1.txt index 2fefeb5..7ec2b7b 100644 --- a/tests/sample_models/orders/orders_target_tree_version1.txt +++ b/tests/sample_models/orders/orders_target_tree_version1.txt @@ -76,4 +76,12 @@ orders: companyId_bic[0, 1]: string companyId_lei[0, 1]: string coordinates[0, 1]: string - a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string \ No newline at end of file + a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string + detail[0, None]: + weight[1, 1]: decimal + unit[1, 1]: string + detail[0, None]: + reference[1, 1]: string + carrier[1, 1]: string + carrierId_vat[0, 1]: string + carrierId_registry[0, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_target_tree_version2.txt b/tests/sample_models/orders/orders_target_tree_version2.txt index 96df78b..9ad2d82 100644 --- a/tests/sample_models/orders/orders_target_tree_version2.txt +++ b/tests/sample_models/orders/orders_target_tree_version2.txt @@ -72,4 +72,12 @@ orders: companyId_type[0, 1]: string companyId_value[0, 1]: string coordinates[0, 1]: string - a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string \ No newline at end of file + a_very_long_field_type_that_makes_col_name_exceeds_max_identifier_length[0, 1]: string + detail[0, None]: + weight[1, 1]: decimal + unit[1, 1]: string + detail[0, None]: + reference[1, 1]: string + carrier[1, 1]: string + carrierId_vat[0, 1]: string + carrierId_registry[0, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/xml/order3.xml b/tests/sample_models/orders/xml/order3.xml index 238dad9..b2aff96 100644 --- a/tests/sample_models/orders/xml/order3.xml +++ b/tests/sample_models/orders/xml/order3.xml @@ -47,6 +47,14 @@ FR + + 12.5 + kg + + + 0.8 + m3 + @@ -67,5 +75,13 @@ + + BL-2023-45 + Acme Transport + + + FR40303265045 + RCS Lyon +