bug #1780 [Examples] Store SQLite database in .sqlite directory (wachterjohannes)

This PR was merged into the main branch.

Discussion
----------

[Examples] Store SQLite database in .sqlite directory

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Docs?         | no
| Issues        |
| License       | MIT

Move the SQLite vector database from `var/` to `.sqlite/` with auto-creation of the directory. Keeps generated files in a gitignored hidden directory.

Commits
-------

beb496fa [Examples] Store SQLite database in .sqlite directory
This commit is contained in:
Christopher Hertel
2026-03-16 21:06:15 +01:00
2 changed files with 5 additions and 1 deletions

View File

@@ -1 +1,2 @@
.symfony-docs/
.sqlite/

View File

@@ -28,7 +28,10 @@ use Symfony\Component\Uid\Uuid;
require_once dirname(__DIR__).'/bootstrap.php';
// initialize the store — file-based SQLite for persistence
$pdo = new PDO('sqlite:'.__DIR__.'/var/vectors.db');
if (!is_dir(__DIR__.'/.sqlite')) {
mkdir(__DIR__.'/.sqlite', 0777, true);
}
$pdo = new PDO('sqlite:'.__DIR__.'/.sqlite/vectors.db');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$store = new Store($pdo, 'movies');
$store->setup();