gen@2.0.0-dev
This commit is contained in:
parent
21a430717c
commit
ab66c2144b
4 changed files with 8 additions and 11 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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<String, OrmBuildContext> _cache = {};
|
||||
|
||||
Future<OrmBuildContext> buildOrmContext(
|
||||
|
@ -162,8 +158,7 @@ Future<OrmBuildContext> 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<OrmBuildContext> buildOrmContext(
|
|||
cascadeOnDelete: cascadeOnDelete,
|
||||
);
|
||||
|
||||
if (isBelongsRelation(relation)) {
|
||||
if (relation.type == RelationshipType.belongsTo) {
|
||||
var name = new ReCase(relation.localKey).camelCase;
|
||||
ctx.buildContext.aliases[name] = relation.localKey;
|
||||
|
||||
|
|
|
@ -434,7 +434,7 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
|||
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
|
||||
|
|
|
@ -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 <thosakwe@gmail.com>
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue