Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install the app if your database is SQLite #3164

Open
ngdangtu-vn opened this issue May 12, 2024 · 1 comment
Open

Unable to install the app if your database is SQLite #3164

ngdangtu-vn opened this issue May 12, 2024 · 1 comment

Comments

@ngdangtu-vn
Copy link

ngdangtu-vn commented May 12, 2024

Akaunting version

5e0f0c7

PHP version

8

Operating system

docker > dunglas/frankenphp

Steps to reproduce

  1. use dunglas/frankenphp dockfile to contain the app
  2. update .env file:
    DB_CONNECTION=sqlite
    DB_DATABASE=account-book.sqlite
  3. run php artisan install --db-name="akaunting" --db-username="root" --db-password="pass" --admin-email="admin@company.com" --admin-password="123456"

Expected result

The server should be installed and work properly

Actual result

php artisan install --db-name="akaunting" --db-username="root" --db-password="pass" --admin-email="admin@company.com" --admin-password="123456" result

Deprecated: Optional parameter $request declared before required parameter $company_id is implicitly treated as a required parameter in /akaunting/app/Utilities/helpers.php on line 381
Deprecated: Optional parameter $request declared before required parameter $company_id is implicitly treated as a required parameter in /akaunting/app/Utilities/helpers.php on line 390
Setting locale en-GB
Creating database tables
Connecting to database database@localhost:3306
Error: Could not connect to the database! Please, make sure the details are correct.

php artisan install result after a few prompt

[2024-05-12 19:27:49] production.ERROR: Debugbar exception: SQLSTATE[HY000]: General error: 1 no such table: users (Connection: sqlite, SQL: select count(*) as aggregate from "users" where (exists (select * from "roles" inner join "user_roles" on "roles"."id" = "user_roles"."role_id" where "users"."id" = "user_roles"."user_id" and exists (select * from "permissions" inner join "role_permissions" on "permissions"."id" = "role_permissions"."permission_id" where "roles"."id" = "role_permissions"."role_id" and "name" = read-admin-panel)) or exists (select * from "permissions" inner join "user_permissions" on "permissions"."id" = "user_permissions"."permission_id" where "users"."id" = "user_permissions"."user_id" and "user_permissions"."user_type" = users and "name" = read-admin-panel)) and "users"."deleted_at" is null)  

2nd attempt with php artisan install
image
(in .env I setted locale as vi-VN but the error return en-GB.)
image

Additional comments

I'm sure that this happen because the laravel didn't recognize the config I set use SQLite, otherwise it wouldn't display this error: database@localhost:3306

After tried to install manually inside the container... I'm not totally clueless.

I tried again the manual way but this time, instead the placeholder text-file.sqlite, I create a real empty sqlite db with this command: sqlite3 file.db "VACUUM;"

Research

I believe there is many part to blame, but I think I'll start from this line first:

$con = config('database.default', 'mysql');

If you guy said: "we only support MySQL." then I wouldn't have any complaint, but this is lazy in writing document 😑 It cleary you guy don't even borther to use DB_CONNECTION env var 😑

@jaedson-correia
Copy link

do you even know laravel? in "config/database.php" you can see that the "default" config uses the var DB_CONNECTION

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

No branches or pull requests

2 participants