Skip to content

Commit

Permalink
add is_main_asset column update
Browse files Browse the repository at this point in the history
  • Loading branch information
prettyirrelevant committed Dec 4, 2024
1 parent 7918eba commit 76930c3
Show file tree
Hide file tree
Showing 5 changed files with 1,879 additions and 23 deletions.
11 changes: 9 additions & 2 deletions tests/test_correct_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ def test_asset_collection_mappings(version, schema_versions):
root_dir = Path(__file__).parents[1]
upgrade = root_dir / 'updates' / str(version) / 'asset_collections_mappings_updates.sql'
# keep this re in sync with the one in the main repo
multiasset_mappings_re = re.compile(r'.*INSERT +INTO +multiasset_mappings\( *collection_id *, *asset *\) *VALUES +\(([^,]*?), *"([^,]+?)"\).*?') # noqa: E501
if version > 30:
pattern = '.*(?:INSERT OR REPLACE|INSERT OR IGNORE|INSERT) +INTO +multiasset_mappings\( *collection_id *, *asset *, *is_main_asset *\) *VALUES +\(([^,]*?), *"([^"]+?)" *, *([0-1])\).*?' # noqa: E501
expected_groups = 3
else:
pattern = r'.*INSERT +INTO +multiasset_mappings\( *collection_id *, *asset *\) *VALUES +\(([^,]*?), *"([^,]+?)"\).*?' # noqa: E501
expected_groups = 2

multiasset_mappings_re = re.compile(pattern) # noqa: E501

if upgrade.exists() is False:
return
Expand All @@ -55,7 +62,7 @@ def test_asset_collection_mappings(version, schema_versions):
mappings_match = multiasset_mappings_re.match(line)
assert mappings_match is not None
groups = mappings_match.groups()
assert len(groups) == 2
assert len(groups) == expected_groups

lineid = int(groups[0])
assert lineid >= 0
Expand Down
Loading

0 comments on commit 76930c3

Please sign in to comment.