From efc72272e13093ce453a55e9f35184a494bfb652 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 30 Apr 2026 00:48:21 +1200 Subject: [PATCH] fix: keep DB credentials populated and skip fulltext indexes on adapters that lack support Two fixes for the SQLite test wiring: 1. .env had emptied _APP_DB_USER/_APP_DB_PASS/_APP_DB_ROOT_PASS, but the mongodb/mariadb/postgresql containers still consume those during init regardless of which adapter Appwrite uses. Empty values left the side-running mongodb (needed for documentsdb) refusing to start, which blocked docker compose up --wait for every CI matrix row, including MongoDB. Restoring the original test credentials. 2. Bootstrap was unconditionally creating fulltext indexes from collection configs. SQLite adapter explicitly returns false for getSupportForFulltextIndex(), so it threw on the first such index. Now the bootstrap consults the adapter and skips fulltext indexes when not supported. Co-Authored-By: Claude Opus 4.7 (1M context) --- .env | 6 +++--- app/http.php | 21 ++++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.env b/.env index 8840493591..ae218308c4 100644 --- a/.env +++ b/.env @@ -44,9 +44,9 @@ _APP_DB_ADAPTER=sqlite _APP_DB_HOST=mongodb _APP_DB_PORT=0 _APP_DB_SCHEMA=appwrite -_APP_DB_USER= -_APP_DB_PASS= -_APP_DB_ROOT_PASS= +_APP_DB_USER=user +_APP_DB_PASS=password +_APP_DB_ROOT_PASS=rootsecretpassword _APP_DB_SQLITE_PATH=/storage/sqlite/appwrite.db _APP_DB_ADAPTER_DOCUMENTSDB=mongodb _APP_DB_HOST_DOCUMENTSDB=mongodb diff --git a/app/http.php b/app/http.php index b72f3b7f34..b867e7218f 100644 --- a/app/http.php +++ b/app/http.php @@ -267,13 +267,20 @@ function createDatabase(Http $app, string $resourceKey, string $dbName, array $c 'format' => $attr['format'] ?? '' ]), $collection['attributes']); - $indexes = array_map(fn ($index) => new Document([ - '$id' => ID::custom($index['$id']), - 'type' => $index['type'], - 'attributes' => $index['attributes'], - 'lengths' => $index['lengths'], - 'orders' => $index['orders'], - ]), $collection['indexes']); + $supportsFulltext = $database->getAdapter()->getSupportForFulltextIndex(); + $indexes = []; + foreach ($collection['indexes'] as $index) { + if ($index['type'] === Database::INDEX_FULLTEXT && !$supportsFulltext) { + continue; + } + $indexes[] = new Document([ + '$id' => ID::custom($index['$id']), + 'type' => $index['type'], + 'attributes' => $index['attributes'], + 'lengths' => $index['lengths'], + 'orders' => $index['orders'], + ]); + } $database->createCollection($key, $attributes, $indexes); $collectionsCreated++;