Insert/Update ManyToMany relations
At the moment it is not possible to update ManyToMany ~~, ManyToOne or OneToMany~~ relations, because the insert/update models are missing the required attributes (and query). That is required, because there is no direct access to the JoinTables (in case of ManyToMany).
Example
// game_model.dart:
abstract class Game {
@PrimaryKey()
@AutoIncrement()
int get id;
List<Genre> get genres;
@BindTo(#sequel)
Game? get prequel;
@BindTo(#prequel)
Game? get sequel;
}
// genre_model.dart:
abstract class Genre {
@PrimaryKey()
@AutoIncrement()
int get id;
String get name;
String? get description;
List<Game> get games;
}
generates:
// game_model.schema.dart:
// [...]
class GameInsertRequest {
GameInsertRequest({
this.prequelId,
});
int? prequelId;
}
class GameUpdateRequest {
GameUpdateRequest({
required this.id,
this.prequelId,
});
int id;
int? prequelId;
}
// genre_model.schema.dart:
// [...]
class GenreInsertRequest {
GenreInsertRequest({
required this.name,
this.description,
});
String name;
String? description;
}
class GenreUpdateRequest {
GenreUpdateRequest({
required this.id,
this.name,
this.description,
});
int id;
String? name;
String? description;
}
I see the problem with many-to-many and missing access to join tables. But can you elaborate whats missing with many-to-one and one-to-many?
I see the problem with many-to-many and missing access to join tables. But can you elaborate whats missing with many-to-one and one-to-many?
My bad. ManyToOne and OneToMany works, just forgot that I changed one of my ManyToOne relations to ManyToMany.