mirror of
https://github.com/symfony/ai.git
synced 2026-03-23 23:42:18 +01:00
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:
1
examples/rag/.gitignore
vendored
1
examples/rag/.gitignore
vendored
@@ -1 +1,2 @@
|
||||
.symfony-docs/
|
||||
.sqlite/
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user