Skip to content

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

@ngdangtu-vn

Description

@ngdangtu-vn

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 😑

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions