Updated angel_orm_generator

This commit is contained in:
thomashii 2021-05-18 08:27:49 +08:00
parent 93ae90f68b
commit 718064ad66

View file

@ -201,7 +201,7 @@ Future<OrmBuildContext?> buildOrmContext(
pluralize(foreign!.buildContext.modelClassNameRecase.snakeCase); pluralize(foreign!.buildContext.modelClassNameRecase.snakeCase);
} on StackOverflowError { } on StackOverflowError {
throw UnsupportedError( throw UnsupportedError(
'There is an infinite cycle between ${clazz.name} and ${field.type.name}. This triggered a stack overflow.'); 'There is an infinite cycle between ${clazz.name} and ${field.type.getDisplayString(withNullability: true)}. This triggered a stack overflow.');
} }
} }
} }
@ -276,7 +276,6 @@ Future<OrmBuildContext?> buildOrmContext(
var foreign = relation.throughContext ?? relation.foreign; var foreign = relation.throughContext ?? relation.foreign;
var type = foreignField.type; var type = foreignField.type;
if (isSpecialId(foreign, foreignField)) { if (isSpecialId(foreign, foreignField)) {
// TODO: incorrect type assignments
//type = field.type.element.context.typeProvider.intType; //type = field.type.element.context.typeProvider.intType;
type = field.type; type = field.type;
} }
@ -288,7 +287,7 @@ Future<OrmBuildContext?> buildOrmContext(
ctx.relations[field.name] = relation; ctx.relations[field.name] = relation;
} else { } else {
if (column.type == null) { if (column.type == null) {
throw 'Cannot infer SQL column type for field "${ctx.buildContext.originalClassName}.${field.name}" with type "${field.type.displayName}".'; throw 'Cannot infer SQL column type for field "${ctx.buildContext.originalClassName}.${field.name}" with type "${field.type.getDisplayString(withNullability: true)}".';
} }
// Expressions... // Expressions...