I am having the issue of trying to create a 1:1 relation between the same table.
@Model()
abstract class Game {
@PrimaryKey()
@AutoIncrement()
int get id;
// [...]
Game? get prequel;
//Game? get sequel; // GameA.sequel = GameB.prequel
}
This will generate a schema with two prequelIds (probably due to cyclic issues, because none are a List). If I also add the sequel it will result into three prequelIds and one sequelId.
Not sure, but perhaps this could be fixed by adding somekind of Join annotation (similar to NestJs Typeorm, Spring Boot JPA, ...) that allows specifying the join column/attribute:
@Model()
abstract class Game {
@PrimaryKey()
@AutoIncrement()
int get id;
// [...]
@Join('sequel')
Game? get prequel;
@Join('prequel')
Game? get sequel;
}
This annotation could also be expanded to allow joins on non-primary key columns.
I am having the issue of trying to create a 1:1 relation between the same table.
This will generate a schema with two
prequelId
s (probably due to cyclic issues, because none are a List). If I also add thesequel
it will result into threeprequelId
s and onesequelId
.Not sure, but perhaps this could be fixed by adding somekind of
Join
annotation (similar to NestJs Typeorm, Spring Boot JPA, ...) that allows specifying the join column/attribute:This annotation could also be expanded to allow joins on non-primary key columns.