Fields inherited via a mixin type on a delegate base model were not
getting their `originModel` set in the generated schema, causing the
ORM to include them in the wrong table's INSERT statement.
Introduces `getOwnedFields` and `getDelegateOriginModel` helpers in
`model-utils.ts` and uses them in both `ts-schema-generator` and
`prisma-schema-generator`, replacing the previous logic that only
checked `field.$container` directly.
Fixes#2351
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixed issue where access policy rules couldn't reference fields inherited from mixins defined in separate imported files. The language service now correctly resolves these fields during scope computation.
## Root Cause
The `getRecursiveBases()` function only searched for mixin declarations in the current document (`decl.$container.declarations`), which failed for imported mixins.
## Solution
- Modified `getRecursiveBases()` to accept optional `LangiumDocuments` parameter
- Implemented two-strategy approach:
1. Use resolved reference if available (post-linking)
2. Search by name across all documents including imports (pre-linking)
- Updated `ZModelScopeComputation.processNode()` to pass `LangiumDocuments`
- Leverages existing `getAllDeclarationsIncludingImports()` helper
## Changes
- **packages/language/src/utils.ts**: Fixed `getRecursiveBases()` to search imported documents
- **packages/language/src/zmodel-scope.ts**: Pass LangiumDocuments to scope computation
- **packages/language/test/mixin.test.ts**: Added tests for imported mixin field resolution
- **packages/testtools**: Added `extraZModelFiles` option for multi-file test schemas
- **tests/regression/test/issue-598.test.ts**: Regression test for the issue
## Test Results
✅ All language package tests pass (65 tests)
✅ Regression test validates policy rules can access imported mixin fields
✅ Handles edge cases: cyclic imports, nested mixins, transitive imports
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* WIP(orm): mysql support
* WIP: more progress with fixing tests
* WIP: get all client api tests pass
* WIP: get all tests pass
* fix executor
* add MySQL to CI matrix
* fix sqlite test runs
* fix test
* fix delete readback check
* set mysql container max connections
* fix tests
* fix test
* refactor: extract duplicated mysql/pg code into base class
* address PR comments
* refactor: remove order by duplicated code
* refactor: optimize stripTableReference
* addressing PR comments
* fix tests
* fix(orm): add special treatment to enum arrays for postgres db
- For input, the string array needs to be casted with "Enum"[]
- For output, the raw pg array string needs to be parsed back to a proper JS string array
fixes#576
* fix enum array filtering and improve test cases
* update
* addressing PR comments