Skip to content

Commit

Permalink
exclude Trigger from query (#4235)
Browse files Browse the repository at this point in the history
* exclude Trigger from query

* CHANGELOG

* Use an excluded list.

* test test

* remove added test
  • Loading branch information
thefrieddan1 committed Apr 16, 2024
1 parent f633b6d commit e115594
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .changelog/4235.yml
@@ -0,0 +1,4 @@
changes:
- description: Content item of type Trigger should not have a from_version, remove it from from_version validation.
type: fix
pr_number: 4235
Expand Up @@ -64,9 +64,10 @@ def validate_unknown_content(
def validate_fromversion(
tx: Transaction, file_paths: List[str], for_supported_versions: bool
):
excluded_from_version = [ContentType.TRIGGER]
op = ">=" if for_supported_versions else "<"
query = f"""// Returning all the USES relationships with where the target's fromversion is higher than the source's
MATCH (content_item_from{{deprecated: false, is_test: false}})-[r:{RelationshipType.USES}{{mandatorily:true}}]->(n)
MATCH (content_item_from:{ContentType.BASE_CONTENT}&!{"&!".join(excluded_from_version)} {{deprecated: false, is_test: false}})-[r:{RelationshipType.USES}{{mandatorily:true}}]->(n)
WHERE {versioned('content_item_from.fromversion')} < {versioned('n.fromversion')}
AND {versioned('n.fromversion')} {op} {versioned(GENERAL_DEFAULT_FROMVERSION)}
AND n.fromversion <> "{DEFAULT_CONTENT_ITEM_FROM_VERSION}" // skips types with no "fromversion"
Expand Down

0 comments on commit e115594

Please sign in to comment.