vania-dart / framework

Fast, simple, and powerful backend framework for Dart built with ❤️
https://vdart.dev
MIT License
155 stars 12 forks source link

[BUG] - Database driver not found #57

Closed D3R50N closed 1 month ago

D3R50N commented 1 month ago

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>
javad-zobeidi commented 1 month ago

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

D3R50N commented 1 month ago

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 ?

javad-zobeidi commented 1 month ago

We are working on this