Skip to content

Conversation

@0xcadams
Copy link
Member

@0xcadams 0xcadams commented Dec 12, 2025

  • Expand the integration Prisma schema and generated Zero schema to cover scalars, enums with @Map values, optional/array handling, table/field mappings, composite PKs, multiple relation shapes (including self-referential M:N), and add a Prisma config plus migration script/fixture to document the generated SQL.
  • Keep Zero table names aligned with Prisma model names (optionally camel-cased) while emitting .from(<dbTable>) when @@map or casing changes; improve relationship mapping by skipping self back-references and producing stable join-column ordering for implicit self many-to-many relations; extend schema-mapper tests for these cases.
  • Update generator import detection to handle generic Zero helpers (e.g., enumeration<T>(), json<T>()), stop emitting the deprecated crud builder, bump to 0.1.0-canary.2, and remove the unused @ts-morph/common dependency.

claude and others added 8 commits December 11, 2025 06:14
- Added exhaustive integration test schema covering all Prisma features:
  - All scalar types (String, Int, Float, Boolean, DateTime, Json, BigInt, Decimal, Bytes)
  - All array types with proper json<T[]>() mapping
  - 5 different enums with @Map support
  - All relationship types (1:1, 1:N, N:N implicit/explicit)
  - Self-referential relationships (parent/children, social follow, blocked users)
  - Composite primary keys (@@id) and composite foreign keys
  - Field mapping (@Map) and table mapping (@@Map)
  - Various @default configurations
  - Native PostgreSQL types (@db.*)
  - Edge cases (reserved words, long names, minimal models)
  - Model exclusion via excludeTables config

- Fixed import generation to correctly extract base types for generics
  (enumeration<T>() -> enumeration, json<T>() -> json)

- Fixed self-referential implicit many-to-many relationships not creating
  join tables (localeCompare returns 0 when model names are identical)

The integration schema is now 990+ lines with 55+ models demonstrating
comprehensive coverage of Prisma schema features.
…ions

- Reduced schema from 990+ lines to 316 lines while maintaining full coverage
- Each model now has clear /// TEST: comments explaining what it tests
- Organized into logical sections: Scalars, Mappings, PKs, Relationships, Edge Cases

Bug fix:
- Fixed self-referential M:N relationships not finding correct backReference
  (find() was returning same field instead of the paired relation field)

Coverage maintained:
- All scalar types (String, Int, Float, Boolean, DateTime, Json, BigInt, Decimal, Bytes)
- Array types → json<T[]>()
- Enums with @Map, enum arrays
- Field @Map and table @@Map
- Composite @@id primary keys
- All relationship types: 1:1, 1:N, implicit M:N, explicit M:N, self-referential
- Multiple relations to same model (creator/assignee pattern)
- Native @db.* types
- excludeTables config
- Edge cases (minimal model, reserved words)
@0xcadams 0xcadams enabled auto-merge (squash) December 12, 2025 00:21
@0xcadams 0xcadams merged commit a3cb1b9 into main Dec 12, 2025
1 check passed
@0xcadams 0xcadams deleted the 0xcadams/integration branch December 12, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants