vania-dart/framework

[BUG] - Database driver not found

D3R50N opened this issue · 3 comments

When trying to run a connection with database I got this :
Exception: Database driver not found

I tried to get data from table using a route /api/users which uses userController.index method.
The line is await User().query().get(). It occurs an exeption. It seems the mysql driver is not found. Even if it's there.

Additional context
Migrations work correctly. Vania can create all tables inside migrations. But can't fetch data.

Logs

Server started on http://127.0.0.1:8000
Unhandled exception:
Exception: Database driver not found
#0      Model._connection (package:vania/src/database/model.dart:9:7)
#1      Model.query (package:vania/src/database/model.dart:20:14)
#2      UserController.index (package:api/app/http/controllers/user_controller.dart:6:32)
#3      Function._apply (dart:core-patch/function_patch.dart:11:71)
#4      Function.apply (dart:core-patch/function_patch.dart:35:12)
#5      ControllerHandler.call (package:vania/src/http/controller/controller_handler.dart:79:26)
#6      httpRequestHandler (package:vania/src/http/request/request_handler.dart:35:57)
<asynchronous suspension>

Did you add 'database': databaseConfig, in config/app.dart

No didn't. It works when I did.
Can you tell why the default is null ? Cause if we need to set to databaseConfig, why not make it the default like in the migration.dart ?

We are working on this