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

Document that SQLite is included? #210

Open
gitressa opened this issue May 30, 2022 · 6 comments
Open

Document that SQLite is included? #210

gitressa opened this issue May 30, 2022 · 6 comments

Comments

@gitressa
Copy link
Contributor

SQLite is supported out of the box, which is great, and you can run this, without having to define database: sqlite in .lando.yml:

$ drush site:install --db-url=sqlite://drupal9:drupal9@database/drupal9 -y

Should SQLite perhaps be added to the list of "Databases" under "Services", together with MariaDB, MongoDB, MySQL, etc. on https://docs.lando.dev/?

@gitressa gitressa added the documentation Improvements or additions to documentation label May 30, 2022
@rtfm-47 rtfm-47 transferred this issue from lando/lando May 30, 2022
@rtfm-47 rtfm-47 added Needs Triage and removed documentation Improvements or additions to documentation labels May 30, 2022
@ultimike
Copy link

I'd also like to know how to use sqlite for PhpUnit tests when connected directly to the container.

By "directly to the container" - I am using VSCode's "Dev container" extension to connect directly to the Lando app container.

For example, with the following in my phpunit.xml file:

<env name="SIMPLETEST_DB" value="sqlite://localhost/tmp/db.sqlite"/>

when running a test, I get a Failed to run installer database tasks: Failed to connect to your database server. error. I've also tried

<env name="SIMPLETEST_DB" value="sqlite://appserver/tmp/db.sqlite"/>

and

<env name="SIMPLETEST_DB" value="sqlite://database/tmp/db.sqlite"/>

with the same result.

If I try to connect to mysql, I get a similar result:

<env name="SIMPLETEST_DB" value="mysql://drupal10:drupal10@database/drupal10#phpunit"/>

What am I missing?

thanks,
-mike

@gitressa
Copy link
Contributor Author

If it's any help, Lando + Drupal Contributions uses SQLite like this in .lando.yml:

SIMPLETEST_DB: "sqlite://localhost/tmp/db.sqlite"

(Note: Add this patch for Drupal 10 compatibility: thinktandem/drupal-contributions#76)

Using VSCode's "Dev container" extension to connect directly to the Lando app container sounds interesting. It would be cool to also get PhpStorm and Lando + Drupal Contributions working that way.

If it's relevant, there's a Free PhpStorm license for +35 Drupal issue credits over the past year, and you seem to qualify.

@ultimike
Copy link

@gitressa Thanks for the info -

I'm not sure what I was doing wrong yesterday, but I tried things again today and it worked (for mysql and sqlite) - very odd.

I didn't add anything to my .lando.yml file. The values I'm using in my phpunit.xml file are:

<env name="SIMPLETEST_BASE_URL" value="http://sitename.lndo.site"/>
<env name="SIMPLETEST_DB" value="mysql://drupal10:drupal10@database/drupal10#phpunit"/>

or

<env name="SIMPLETEST_BASE_URL" value="http://sitename.lndo.site"/>
<env name="SIMPLETEST_DB" value="sqlite://localhost/tmp/db.sqlite"/>

I'm all set with a PhpStorm license, but thanks for the info.

-mike

@gitressa
Copy link
Contributor Author

Great that you got it working. Sometimes all it takes is a restart :)

And thanks by the way for blogging about PhpStorm in Setting up Xdebug with Lando and PhpStorm in 2018. It was quite helpful when I recently had to set it up myself.

Since then (as you probably know) things have luckily changed and most of the configuration happens automagically. So I updated the documentation for Configuring PhpStorm and Xdebug in Lando for Drupal 10 the other day, in case you're interested. Have a great day

@ultimike
Copy link

Yep, I'm well aware - I teach with various combinations of PhpStorm/VSCode + Lando/DDEV, including setting up all the things (PhpUnit, PhpStan, phpcs, Xdebug) integrated with the IDE.

I'm working on adding connecting both PhpStorm and VSCode directly to the Lando/DDEV app/web container with all the same tools integrated in the IDE.

thanks again!
-mike

@gitressa
Copy link
Contributor Author

Great! I hope you get it all working, adding PHPUnit to the mix adds a little extra challenge :)

I now realize that is also what lando/php#6 is about. I'll have a go at it later, and add it to the "Configuring PhpStorm and Xdebug in Lando" for Drupal 10 guide if I succeed.

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

No branches or pull requests

3 participants