angelxmoreno / angelxmoreno/bun-sqlite-orm
[Feature]: Complete relationship decorators and management system
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
**Problem Statement:**
The ORM currently lacks relationship support, which is essential for modeling complex data structures and reducing boilerplate code for related entity operations. Need a comprehensive system that supports all common relationship types.
**Proposed Solution:**
Implement complete relationship decorator system with all relationship types:
```typescript
// One-to-Many / Many-to-One (bidirectional)
@Entity('users')
export class User extends BaseEntity {
@PrimaryGeneratedColumn()
id\!: number;
@OneToMany(() => Post, post => post.user)
posts\!: Post[];
@OneToOne(() => Profile, profile => profile.user)
profile\!: Profile;
}
@Entity('posts')
export class Post extends BaseEntity {
@PrimaryGeneratedColumn()
id\!: number;
@ManyToOne(() => User, user => user.posts, { nullable: false })
@JoinColumn({ name: 'user_id' })
user\!: User;
@Column()
userId\!: number;
@ManyToMany(() => Tag, tag => tag.posts)
@JoinTable({ name: 'post_tags' })
tags\!: Tag[];
}
```
**Implementation Requirements:**
- @OneToMany / @ManyToOne decorators with inverse mapping
- @OneToOne decorator with optional @JoinColumn
- @ManyToMany decorator with @JoinTable for junction tables
- Automatic foreign key constraint creation
- Nullable/non-nullable relationship options
- Custom join column naming with @JoinColumn
- Junction table management for many-to-many
- Lazy loading support for all relationship types
- Eager loading with findWithRelations method
- Nested relation loading (e.g., 'posts.tags')
- Cascade options (save, delete, update)
- Proper TypeScript type inference
- Relationship metadata system
- JOIN query generation
Contributor guide
Research direction
The issue names no files, tests, or entry points, so a newcomer would first need to map the ORM's entity, metadata, and query layers. Use the listed relationship decorators, loading, cascade, constraint, and JOIN requirements as acceptance criteria; completion means the requested relationship types and behaviors are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, sqlite, typescript
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100