Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

aqueduct db generate Uncaught error missing files #809

Closed
Blackheart8788 opened this issue Apr 11, 2020 · 6 comments
Closed

aqueduct db generate Uncaught error missing files #809

Blackheart8788 opened this issue Apr 11, 2020 · 6 comments

Comments

@Blackheart8788
Copy link

Blackheart8788 commented Apr 11, 2020

Hi everyone, I'm new to aqueduct, i was going throught the tour of heroes and in the migrations part i got stuck with this error

aqueduct db generate
-- Aqueduct CLI Version: 3.2.1
-- Aqueduct project version: 3.3.0-b1
*** Uncaught error
IsolateSpawnException: Unable to spawn isolate: data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20
'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart'%3B%0AFutur
e%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'sendPort'%5D%3B%0
A%20%20final%20executable%20%3D%20new%20SchemaBuilderExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.s
end(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20SchemaBuilderExecutable%20extends%20Executable%3CMap%3CString%2C%20dynamic%3E%3E%20%7B
SchemaBuilderExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20inputSchema%20%3D%20Schema.fromMap(message%5B%22schema%22%5D%20as%20Map%3CString%2C%2
0dynamic%3E)%2C%20sources%20%3D%20(message%5B%22sources%22%5D%20as%20List%3CMap%3E).map((m)%20%3D%3E%20MigrationSource.fromMap(m%20as%20Map%3CString%2C%20dyn
amic%3E)).toList()%2C%20super(message)%3B%20SchemaBuilderExecutable.input(this.sources%2C%20this.inputSchema)%20%3A%20super(%7B%22schema%22%20%3A%20inputSche
ma.asMap()%2C%20%22sources%22%20%3A%20sources.map((source)%20%3D%3E%20source.asMap()).toList()%7D)%3B%20final%20List%3CMigrationSource%3E%20sources%3B%20fina
l%20Schema%20inputSchema%3B%20%40override%20Future%3CMap%3CString%2C%20dynamic%3E%3E%20execute()%20async%20%7BhierarchicalLoggingEnabled%20%3D%20true%3B%20Po
stgreSQLPersistentStore.logger.level%20%3D%20Level.ALL%3B%20PostgreSQLPersistentStore.logger.onRecord.listen((r)%20%3D%3E%20log(%22%24%7Br.message%7D%22))%3B%20try%20%7Bvar%20outputSchema%20%3D%20inputSchema%3B%20for%20(var%20source%20in%20sources)%20%7BMigration%20instance%20%3D%20instanceOf(source.name)%3B%20instance.database%20%3D%20SchemaBuilder(null%2C%20outputSchema)%3B%20await%20instance.upgrade()%3B%20outputSchema%20%3D%20instance.currentSchema%3B%7D%20return%20outputSchema.asMap()%3B%7D%20on%20SchemaException%20catch%20(e)%20%7Breturn%20%7B%22error%22%20%3A%20%22There%20was%20an%20issue%20with%20the%20schema%20generated%20by%20replaying%20this%20project's%20migration%20files.%20Reason%3A%20%24%7Be.message%7D%22%7D%3B%7D%7D%20static%20List%3CString%3E%20get%20imports%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line
%22%20%3A%20message%7D)%3B%7D%7D%0A%0A:5:8: Error: Error when reading '../../../.pub-cache/hosted/pub.dartlang.org/aqueduct-3.3.0-b1/lib/src/db/schema/migration_source.dart': No such file or directory
import 'package:aqueduct/src/db/schema/migration_source.dart';
^
data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20SchemaBuilderExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20SchemaBuilderExecutable%20extends%20Executable%3CMap%3CString%2C%20dynamic%3E%3E%20%7BSchemaBuilderExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20inputSchema%20%3D%20Schema.fromMap(message%5B%22schema%22%5D%20as%20Map%3CString%2C%20dynamic%3E)%2C%20sources%20%3D%20(message%5B%22sources%22%5D%20as%20List%3CMap%3E).map((m)%20%3D%3E%20MigrationSource.fromMap(m%20as%20Map%3CString%2C%20dynamic%3E)).toList()%2C%20super(message)%3B%20SchemaBuilderExecutable.input(this.sources%2C%20this.inputSchema)%20%3A%20super(%7B%22schema%22%20%3A%20inputSchema.asMap()%2C%20%22sources%22%20%3A%20sources.map((source)%20%3D%3E%20source.asMap()).toList()%7D)%3B%20final%20List%3CMigrationSource%3E%20sources%3B%20final%20Schema%20inputSchema%3B%20%40override%20Future%3CMap%3CString%2C%20dynamic%3E%3E%20execute()%20async%20%7BhierarchicalLoggingEnabled%20%3D%20true%3B%20PostgreSQLPersistentStore.logger.level%20%3D%20Level.ALL%3B%20PostgreSQLPersistentStore.logger.onRecord.listen((r)%20%3D%3E%20log(%22%24%7Br.message%7D%22))%3B%20try%20%7Bvar%20outputSchema%20%3D%20inputSchema%3B%20for%20(var%20source%20in%20sources)%20%7BMigration%20instance%20%3D%20instanceOf(source.name)%3B%20instance.database%20%3D%20SchemaBuilder(null%2C%20outputSchema)%3B%20await%20instance.upgrade()%3B%20outputSchema%20%3D%20instance.currentSchema%3B%7D%20return%20outputSchema.asMap()%3B%7D%20on%20SchemaException%20catch%20(e)%20%7Breturn%20%7B%22error%22%20%3A%20%22There%20was%20an%20issue%20with%20the%20schema%20generated%20by%20replaying%20this%20project's%20migration%20files.%20Reason%3A%20%24%7Be.message%7D%22%7D%3B%7D%7D%20static%20List%3CString%3E%20get%20imports%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line%22%20%3A%20message%7D)%3B%7D%7D%0A%0A:13:513: Error: Type 'MigrationSource' not found.
class SchemaBuilderExecutable extends Executable<Map<String, dynamic>> {SchemaBuilderExecutable(Map<String, dynamic> message) : inputSchema = Schema.fromMap(message["schema"] as Map<String, dynamic>), sources = (message["sources"] as List).map((m) => MigrationSource.fromMap(m as Map<String, dynamic>)).toList(), super(message); SchemaBuilderExecutable.input(this.sources, this.inputSchema) : super({"schema" : inputSchema.asMap(), "sources" : sources.map((source) => source.asMap()).toList()}); final List sources; final Schema inputSchema; @OverRide Future<Map<String, dynamic>> execute() async {hierarchicalLoggingEnabled = true; PostgreSQLPersistentStore.logger.level = Level.ALL; PostgreSQLPersistentStore.logger.onRecord.listen((r) => log("${r.message}")); try {var outputSchema = inputSchema; for (var source in sources) {Migration instance = instanceOf(source.name); instance.database = SchemaBuilder(null, outputSchema); await instance.upgrade(); outputSchema = instance.currentSchema;} return outputSchema.asMap();} on SchemaException catch (e) {return {"error" : "There was an issue with the schema generated by replaying this project's migration files. Reason: ${e.message}"};}} static List get imports => ["package:aqueduct/aqueduct.dart", "package:aqueduct/src/db/schema/migration_source.dart"];}
^^^^^^^^^^^^^^^
data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20SchemaBuilderExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20SchemaBuilderExecutable%20extends%20Executable%3CMap%3CString%2C%20dynamic%3E%3E%20%7BSchemaBuilderExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20inputSchema%20%3D%20Schema.fromMap(message%5B%22schema%22%5D%20as%20Map%3CString%2C%20dynamic%3E)%2C%20sources%20%3D%20(message%5B%22sources%22%5D%20as%20List%3CMap%3E).map((m)%20%3D%3E%20MigrationSource.fromMap(m%20as%20Map%3CString%2C%20dynamic%3E)).toList()%2C%20super(message)%3B%20SchemaBuilderExecutable.input(this.sources%2C%20this.inputSchema)%20%3A%20super(%7B%22schema%22%20%3A%20inputSchema.asMap()%2C%20%22sources%22%20%3A%20sources.map((source)%20%3D%3E%20source.asMap()).toList()%7D)%3B%20final%20List%3CMigrationSource%3E%20sources%3B%20final%20Schema%20inputSchema%3B%20%40override%20Future%3CMap%3CString%2C%20dynamic%3E%3E%20execute()%20async%20%7BhierarchicalLoggingEnabled%20%3D%20true%3B%20PostgreSQLPersistentStore.logger.level%20%3D%20Level.ALL%3B%20PostgreSQLPersistentStore.logger.onRecord.listen((r)%20%3D%3E%20log(%22%24%7Br.message%7D%22))%3B%20try%20%7Bvar%20outputSchema%20%3D%20inputSchema%3B%20for%20(var%20source%20in%20sources)%20%7BMigration%20instance%20%3D%20instanceOf(source.name)%3B%20instance.database%20%3D%20SchemaBuilder(null%2C%20outputSchema)%3B%20await%20instance.upgrade()%3B%20outputSchema%20%3D%20instance.currentSchema%3B%7D%20return%20outputSchema.asMap()%3B%7D%20on%20SchemaException%20catch%20(e)%20%7Breturn%20%7B%22error%22%20%3A%20%22There%20was%20an%20issue%20with%20the%20schema%20generated%20by%20replaying%20this%20project's%20migration%20files.%20Reason%3A%20%24%7Be.message%7D%22%7D%3B%7D%7D%20static%20List%3CString%3E%20get%20imports%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line%22%20%3A%20message%7D)%3B%7D%7D%0A%0A:13:257: Error: The getter 'MigrationSource' isn't defined for the class 'SchemaBuilderExecutable'.

  • 'SchemaBuilderExecutable' is from 'data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20SchemaBuilderExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20SchemaBuilderExecutable%20extends%20Executable%3CMap%3CString%2C%20dynamic%3E%3E%20%7BSchemaBuilderExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20inputSchema%20%3D%20Schema.fromMap(message%5B%22schema%22%5D%20as%20Map%3CString%2C%20dynamic%3E)%2C%20sources%20%3D%20(message%5B%22sources%22%5D%20as%20List%3CMap%3E).map((m)%20%3D%3E%20MigrationSource.fromMap(m%20as%20Map%3CString%2C%20dynamic%3E)).toList()%2C%20super(message)%3B%20SchemaBuilderExecutable.input(this.sources%2C%20this.inputSchema)%20%3A%20super(%7B%22schema%22%20%3A%20inputSchema.asMap()%2C%20%22sources%22%20%3A%20sources.map((source)%20%3D%3E%20source.asMap()).toList()%7D)%3B%20final%20List%3CMigrationSource%3E%20sources%3B%20final%20Schema%20inputSchema%3B%20%40override%20Future%3CMap%3CString%2C%20dynamic%3E%3E%20execute()%20async%20%7BhierarchicalLoggingEnabled%20%3D%20true%3B%20PostgreSQLPersistentStore.logger.level%20%3D%20Level.ALL%3B%20PostgreSQLPersistentStore.logger.onRecord.listen((r)%20%3D%3E%20log(%22%24%7Br.message%7D%22))%3B%20try%20%7Bvar%20outputSchema%20%3D%20inputSchema%3B%20for%20(var%20source%20in%20sources)%20%7BMigration%20instance%20%3D%20instanceOf(source.name)%3B%20instance.database%20%3D%20SchemaBuilder(null%2C%20outputSchema)%3B%20await%20instance.upgrade()%3B%20outputSchema%20%3D%20instance.currentSchema%3B%7D%20return%20outputSchema.asMap()%3B%7D%20on%20SchemaException%20catch%20(e)%20%7Breturn%20%7B%22error%22%20%3A%20%22There%20was%20an%20issue%20with%20the%20schema%20generated%20by%20replaying%20this%20project's%20migration%20files.%20Reason%3A%20%24%7Be.message%7D%22%7D%3B%7D%7D%20static%20List%3CString%3E%20get%20imports%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line%22%20%3A%20message%7D)%3B%7D%7D%0A%0A'.
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'MigrationSource'.
    class SchemaBuilderExecutable extends Executable<Map<String, dynamic>> {SchemaBuilderExecutable(Map<String, dynamic> message) : inputSchema = Schema.fromMap(message["schema"] as Map<String, dynamic>), sources = (message["sources"] as List).map((m) => MigrationSource.fromMap(m as Map<String, dynamic>)).toList(), super(message); SchemaBuilderExecutable.input(this.sources, this.inputSchema) : super({"schema" : inputSchema.asMap(), "sources" : sources.map((source) => source.asMap()).toList()}); final List sources; final Schema inputSchema; @OverRide Future<Map<String, dynamic>> execute() async {hierarchicalLoggingEnabled = true; PostgreSQLPersistentStore.logger.level = Level.ALL; PostgreSQLPersistentStore.logger.onRecord.listen((r) => log("${r.message}")); try {var outputSchema = inputSchema; for (var source in sources) {Migration instance = instanceOf(source.name); instance.database = SchemaBuilder(null, outputSchema); await instance.upgrade(); outputSchema = instance.currentSchema;} return outputSchema.asMap();} on SchemaException catch (e) {return {"error" : "There was an issue with the schema generated by replaying this project's migration files. Reason: ${e.message}"};}} static List get imports => ["package:aqueduct/aqueduct.dart", "package:aqueduct/src/db/schema/migration_source.dart"];}
    ^^^^^^^^^^^^^^^
    data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20SchemaBuilderExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20SchemaBuilderExecutable%20extends%20Executable%3CMap%3CString%2C%20dynamic%3E%3E%20%7BSchemaBuilderExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20inputSchema%20%3D%20Schema.fromMap(message%5B%22schema%22%5D%20as%20Map%3CString%2C%20dynamic%3E)%2C%20sources%20%3D%20(message%5B%22sources%22%5D%20as%20List%3CMap%3E).map((m)%20%3D%3E%20MigrationSource.fromMap(m%20as%20Map%3CString%2C%20dynamic%3E)).toList()%2C%20super(message)%3B%20SchemaBuilderExecutable.input(this.sources%2C%20this.inputSchema)%20%3A%20super(%7B%22schema%22%20%3A%20inputSchema.asMap()%2C%20%22sources%22%20%3A%20sources.map((source)%20%3D%3E%20source.asMap()).toList()%7D)%3B%20final%20List%3CMigrationSource%3E%20sources%3B%20final%20Schema%20inputSchema%3B%20%40override%20Future%3CMap%3CString%2C%20dynamic%3E%3E%20execute()%20async%20%7BhierarchicalLoggingEnabled%20%3D%20true%3B%20PostgreSQLPersistentStore.logger.level%20%3D%20Level.ALL%3B%20PostgreSQLPersistentStore.logger.onRecord.listen((r)%20%3D%3E%20log(%22%24%7Br.message%7D%22))%3B%20try%20%7Bvar%20outputSchema%20%3D%20inputSchema%3B%20for%20(var%20source%20in%20sources)%20%7BMigration%20instance%20%3D%20instanceOf(source.name)%3B%20instance.database%20%3D%20SchemaBuilder(null%2C%20outputSchema)%3B%20await%20instance.upgrade()%3B%20outputSchema%20%3D%20instance.currentSchema%3B%7D%20return%20outputSchema.asMap()%3B%7D%20on%20SchemaException%20catch%20(e)%20%7Breturn%20%7B%22error%22%20%3A%20%22There%20was%20an%20issue%20with%20the%20schema%20generated%20by%20replaying%20this%20project's%20migration%20files.%20Reason%3A%20%24%7Be.message%7D%22%7D%3B%7D%7D%20static%20List%3CString%3E%20get%20imports%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3Aaqueduct%2Fsrc%2Fdb%2Fschema%2Fmigration_source.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line%22%20%3A%20message%7D)%3B%7D%7D%0A%0A:13:513: Error: 'MigrationSource' isn't a type.
    class SchemaBuilderExecutable extends Executable<Map<String, dynamic>> {SchemaBuilderExecutable(Map<String, dynamic> message) : inputSchema = Schema.fromMap(message["schema"] as Map<String, dynamic>), sources = (message["sources"] as List).map((m) => MigrationSource.fromMap(m as Map<String, dynamic>)).toList(), super(message); SchemaBuilderExecutable.input(this.sources, this.inputSchema) : super({"schema" : inputSchema.asMap(), "sources" : sources.map((source) => source.asMap()).toList()}); final List sources; final Schema inputSchema; @OverRide Future<Map<String, dynamic>> execute() async {hierarchicalLoggingEnabled = true; PostgreSQLPersistentStore.logger.level = Level.ALL; PostgreSQLPersistentStore.logger.onRecord.listen((r) => log("${r.message}")); try {var outputSchema = inputSchema; for (var source in sources) {Migration instance = instanceOf(source.name); instance.database = SchemaBuilder(null, outputSchema); await instance.upgrade(); outputSchema = instance.currentSchema;} return outputSchema.asMap();} on SchemaException catch (e) {return {"error" : "There was an issue with the schema generated by replaying this project's migration files. Reason: ${e.message}"};}} static List get imports => ["package:aqueduct/aqueduct.dart", "package:aqueduct/src/db/schema/migration_source.dart"];}
    ^^^^^^^^^^^^^^^
    **** Stacktrace

@Blackheart8788
Copy link
Author

hi, turns out that the files that were missing were not from de CLI folders but from the aqueduct project folders, so I copy all the missing files from CLI Dir to Aqueduct Project folder.

It's not a nice fix, but it worked.

@PavelS0
Copy link

PavelS0 commented Apr 15, 2020

Same problem, on existing project after upgrade to 3.3.0-b1

@MarcElrick
Copy link

I'm getting the same issue.

@muflihfq
Copy link

muflihfq commented May 1, 2020

try pub run aqueduct db generate, it's work for me

@itsjoeconway
Copy link
Contributor

The issue here is that your CLI is a different version than your project. Unfortunately, this isn't your fault - there is a dependency version solving issue that is upgrading everyone's project to a pre-release version. The current solve is to pin your Aqueduct project's pubspec.yaml to version 3.2.1.

dependencies:
  aqueduct: 3.2.1

@Blackheart8788
Copy link
Author

Hi everyone hope you’re fine and healthy. @joeconwaystk thanks for you’re response it worked nicely for me. Hope it works for everyone else.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants