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

Error with the database when installing version 1.2.4 #1060

Closed
WebProviderNGO opened this issue Feb 22, 2024 · 9 comments · Fixed by #1077
Closed

Error with the database when installing version 1.2.4 #1060

WebProviderNGO opened this issue Feb 22, 2024 · 9 comments · Fixed by #1077

Comments

@WebProviderNGO
Copy link

Winter CMS Build

1.2

PHP Version

8.1

Database engine

SQLite

Plugins installed

No response

Issue description

After installing v1.2.4, when accessing the Backend, the error is "Database missing".

In the console after executing php artisan winter:up error:

In Connection.php line 760:                                                                                                                                                     
could not find driver (SQL: select * from information_schema.tables where table_schema = database and table_name = migrations and table_type = 'BASE TABLE')  
In Exception.php line 18:
could not find driver  
In PDOConnection.php line 40:
could not find driver

I carry out the installation as always, there have never been any problems before. Tried it on several independent hosting providers.

In the new version, I noticed that it is now necessary to specify the path to the database. I tried in the root (by default) and the storage folder (as was the case in older versions).

To work around the bug, I install v1.2.2 first and then update. Everything works without errors.

Steps to replicate

Just install a new project with a new version :)

Workaround

To work around the bug, I install v1.2.2 first and then update. Everything works without errors.

@LukeTowers
Copy link
Member

@WebProviderNGO this is very odd, our default DB config hasn't changed in years: https://github.com/wintercms/winter/blob/develop/config/database.php#L35

@mjauvin are you able to replicate this?

@mjauvin
Copy link
Member

mjauvin commented Feb 27, 2024

@LukeTowers the difference is that you added the following to core composer.json:

    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],

So even when selecting SQLite as the database engine during the install, the database gets taken from the .env file (which contains mysql as the database).

@mjauvin
Copy link
Member

mjauvin commented Feb 27, 2024

@LukeTowers I think we should remove/comment out the DB_* settings in the .env.example file, that would resolve the issue.

@bennothommo
Copy link
Member

I would probably prefer removing that script entirely. While I am all for environment files, Winter works fine without them, and some people prefer the config files.

I know this was added in #939 to support Laravel Sail, but I would imagine one could simply copy .env.example to .env as part of the bootstrap process and still achieve the same effect.

@mjauvin
Copy link
Member

mjauvin commented Feb 28, 2024

@bennothommo what does the web-installer do with the config? Does it fill-in the dotEnv file or the config/database.php one ?

@bennothommo
Copy link
Member

@mjauvin it fills out the config currently, using the Laravel Config Writer that @jaxwilko wrote.

@mjauvin
Copy link
Member

mjauvin commented Mar 1, 2024

@bennothommo So I assume you remove the script entry in the composer.json ?

@jaxwilko
Copy link
Member

jaxwilko commented Mar 1, 2024

My personal view would be to remove the script in composer.json and either people can run cp .env.example .env or ./artisan winter:env

@LukeTowers
Copy link
Member

@marvindurot Will this break your workflow if we remove the command from the composer script but leave the example file?

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

Successfully merging a pull request may close this issue.

5 participants