diff --git a/angel_orm_generator/CHANGELOG.md b/angel_orm_generator/CHANGELOG.md index 33aab2bf..a7fbbbc2 100644 --- a/angel_orm_generator/CHANGELOG.md +++ b/angel_orm_generator/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.0.0-dev +* Dart 2 updates, and more. + # 1.0.0-alpha+6 * `DateTime` is now `CAST` on insertion and update operations. diff --git a/angel_orm_generator/lib/src/orm_build_context.dart b/angel_orm_generator/lib/src/orm_build_context.dart index 9e65c19e..a4bd531c 100644 --- a/angel_orm_generator/lib/src/orm_build_context.dart +++ b/angel_orm_generator/lib/src/orm_build_context.dart @@ -19,10 +19,6 @@ import 'readers.dart'; bool isHasRelation(Relationship r) => r.type == RelationshipType.hasOne || r.type == RelationshipType.hasMany; -bool isBelongsRelation(Relationship r) => - r.type == RelationshipType.belongsTo || - r.type == RelationshipType.belongsToMany; - final Map _cache = {}; Future buildOrmContext( @@ -162,8 +158,7 @@ Future buildOrmContext( if (type == RelationshipType.hasOne || type == RelationshipType.hasMany) { localKey ??= 'id'; foreignKey ??= '${rc.snakeCase}_id'; - } else if (type == RelationshipType.belongsTo || - type == RelationshipType.belongsToMany) { + } else if (type == RelationshipType.belongsTo) { localKey ??= '${rcc.snakeCase}_id'; foreignKey ??= 'id'; } @@ -176,7 +171,7 @@ Future buildOrmContext( cascadeOnDelete: cascadeOnDelete, ); - if (isBelongsRelation(relation)) { + if (relation.type == RelationshipType.belongsTo) { var name = new ReCase(relation.localKey).camelCase; ctx.buildContext.aliases[name] = relation.localKey; diff --git a/angel_orm_generator/lib/src/orm_generator.dart b/angel_orm_generator/lib/src/orm_generator.dart index abb6be2b..84d48cba 100644 --- a/angel_orm_generator/lib/src/orm_generator.dart +++ b/angel_orm_generator/lib/src/orm_generator.dart @@ -434,7 +434,7 @@ class OrmGenerator extends GeneratorForAnnotation { builderType = refer('DateTimeSqlExpressionBuilder'); } else if (ctx.relations.containsKey(field.name)) { var relation = ctx.relations[field.name]; - if (!isBelongsRelation(relation)) + if (relation.type != RelationshipType.belongsTo) continue; else { builderType = new TypeReference((b) => b diff --git a/angel_orm_generator/pubspec.yaml b/angel_orm_generator/pubspec.yaml index 086dd300..c287dde2 100644 --- a/angel_orm_generator/pubspec.yaml +++ b/angel_orm_generator/pubspec.yaml @@ -1,13 +1,12 @@ name: angel_orm_generator -version: 2.0.0-alpha +version: 2.0.0-dev description: Code generators for Angel's ORM. Generates query builder classes. author: Tobe O homepage: https://github.com/angel-dart/orm environment: sdk: ">=2.0.0-dev <3.0.0" dependencies: - angel_orm: - path: ../angel_orm + angel_orm: ^2.0.0-dev angel_serialize_generator: ^2.0.0 build: ">=0.12.0 <2.0.0" build_config: ^0.3.0