Skip to content

Conversation

@samuelstroschein
Copy link
Member

@samuelstroschein samuelstroschein commented Nov 18, 2025

Note

Adds file-aware PK/unique indexing and configurable foreign-key scope, plus a new (version_id, entity_id) index; updates tests and bench plans accordingly.

  • Indexes/Schema Cache:
    • Add idx_<table>_ve on (version_id, entity_id) in create-schema-cache-table.ts.
    • Update buildSchemaIndexSpecs to include file_id in PK/unique index expressions and support configurable FK scope (default version_id,file_id).
    • Generate index names accordingly in schema-indexes.ts; add normalization for FK scope.
  • Tests:
    • Adjust index expectations to include file_id and new column orders; add test ensuring FK respects custom scope.
    • Add simulation validating file-scoped unique constraints allow duplicates across files via lix_internal_state_vtable.
  • Bench/Plans:
    • Update explain plans to reflect new/renamed indexes (e.g., ..._ve, file-scoped index suffixes) and added file_id predicates in validation queries.

Written by Cursor Bugbot for commit 334f404. This will update automatically on new commits. Configure here.

- Updated SQL queries in `validate-state-mutation.primary-key.explain.txt` and `validate-state-mutation.unique-nested.explain.txt` to include `file_id` as a parameter for filtering.
- Modified the explain plans to reflect changes in index usage for improved performance.
- Added tests in `validate-state-mutation.playground.test.ts` and `vtable.test.ts` to validate the behavior of file-scoped unique constraints, ensuring that duplicates are allowed across different files.
- Adjusted the query plans in `select-version-diff.playground-plan.txt` to incorporate `file_id` in relevant index searches.
@changeset-bot
Copy link

changeset-bot bot commented Nov 18, 2025

⚠️ No Changeset found

Latest commit: 334f404

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@samuelstroschein samuelstroschein temporarily deployed to indeces-for-constraints - lix-docs PR #3750 November 18, 2025 19:45 — with Render Destroyed
@nx-cloud
Copy link

nx-cloud bot commented Nov 18, 2025

View your CI Pipeline Execution ↗ for commit 334f404

Command Status Duration Result
nx run-many --nx-bail --target=build --parallel ✅ Succeeded 1m 12s View ↗
nx run-many --target=test --parallel ✅ Succeeded 3m 47s View ↗
nx run-many --target=lint --parallel ✅ Succeeded 11s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-18 19:51:52 UTC

@samuelstroschein samuelstroschein merged commit 6e2ef34 into main Nov 18, 2025
3 checks passed
@samuelstroschein samuelstroschein deleted the indeces-for-constraints branch November 18, 2025 19:53
@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants