-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ORM relation hasMany don't generate #76
Comments
I've make some adjustments on the two classes. A couple of notes:
import 'package:angel3_migration/angel3_migration.dart';
import 'package:angel3_orm/angel3_orm.dart';
import 'package:angel3_serialize/angel3_serialize.dart';
import 'package:optional/optional.dart';
part 'shop.g.dart';
@Orm(tableName: 'contracts_shop')
@serializable
abstract class _Shop {
/// A unique identifier corresponding to this item.
@Column(indexType: IndexType.primaryKey)
int? id;
String get name;
int? get industryId;
DateTime get added;
@HasMany(foreignKey: 'id')
List<_Supplier> get suppliers;
}
@Orm(tableName: 'suppliers_supplier')
@serializable
abstract class _Supplier {
/// A unique identifier corresponding to this item.
@Column(indexType: IndexType.primaryKey)
int? id;
@BelongsTo(foreignKey: 'id')
_Shop? get shop;
String get fullName;
String get email;
String get iban;
String get accountName;
String? get phoneNumber;
@Column(defaultValue: true)
bool get isEnabled;
DateTime get lastMod;
DateTime get added;
} |
Trying to get basic relationships to work and hitting a hard wall using the latest releases:
I can't figure out what I'm doing wrong if any, and the documentation does not have an example for
|
At the moment, models with relationship need to be defined in the same file. This is a known limitation and pain point that will be addressed soon. The following revised code should work. Noted on the document, it will be updated.
|
Hey, I didn't find any examples of complex relation between tables except the doc.
I have an existing database where I want to plug a Dart server.
I've tried this:
But the generation command gives:
The text was updated successfully, but these errors were encountered: