Jaguar-dart / jaguar_orm

Source-generated ORM with relations (one-to-one, one-to-many, many-to-many), preloading, cascading, polymorphic relations, etc
https://jaguar-dart.github.io
BSD 3-Clause "New" or "Revised" License
217 stars 52 forks source link

BugFix/121 #124

Closed isaacfi closed 5 years ago

isaacfi commented 5 years ago

I made some changes to add isPrimary property to ForeingKey and BelongsTo annotations and support the foreing-primary key columns as my request #121

Evaluate it and pull it as soon as posible, and ignore the change on this file: generator/pubspec.yaml

JamesMcIntosh commented 5 years ago

I think your first attempt of removing the constraint of the number of annotations per fields looks better. The way the annotations are structured seems like they are trying to do too much for the sake of not having multiple annotations per field.

I would expect that the features which are common to every column are encapsulated discretely inside Column annotation and that the Column annotation is only supplied where it needs to be overridden as required as they all have sensible defaults. i.e. changing the name of the column. This would also mean that auto incrementing is no longer in Column.

class Model {

@PrimaryKey(auto: false)
@Column(name: "model_id")
int id;

}
tejainece commented 5 years ago

@isaacfi Thanks for the PR: I will review it and merge it.

tejainece commented 5 years ago

@JamesMcIntosh I agree. Can you please create a new issue for that please?

tejainece commented 5 years ago

Created an issue here: https://github.com/Jaguar-dart/jaguar_orm/issues/136

isaacfi commented 4 years ago

Hi @tejainece and @JamesMcIntosh

In the newer version this fix has lost I think that you changed the parser structure, and again, a column cannot be primary key and foreign key at the same time. Can you review this issue again please?