diff --git a/.env.example b/.env.example
index c28ab4eec..95fc1dfb5 100644
--- a/.env.example
+++ b/.env.example
@@ -21,12 +21,6 @@ DB_DATABASE="biigle"
DB_USERNAME="biigle"
DB_PASSWORD="secret"
-VECTOR_DB_HOST="vector_database"
-VECTOR_DB_PORT=5432
-VECTOR_DB_DATABASE="biigle"
-VECTOR_DB_USERNAME="biigle"
-VECTOR_DB_PASSWORD="secret"
-
VOLUME_ADMIN_STORAGE_DISKS=local
BROADCAST_DRIVER=pusher
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 186e9b977..20158218a 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -37,7 +37,6 @@ jobs:
- name: Start test database
run: |
docker-compose up -d --no-build database_testing
- docker-compose up -d --no-build vector_database_testing
sleep 5
- name: Run tests
@@ -80,7 +79,6 @@ jobs:
- name: Start test database
run: |
docker-compose up -d --no-build database_testing
- docker-compose up -d --no-build vector_database_testing
sleep 5
- name: Run tests
diff --git a/config/database.php b/config/database.php
index b3a9e5583..90ce98207 100644
--- a/config/database.php
+++ b/config/database.php
@@ -78,21 +78,6 @@
'sslmode' => 'prefer',
],
- 'pgvector' => [
- 'driver' => 'pgsql',
- 'url' => env('VECTOR_DATABASE_URL'),
- 'host' => env('VECTOR_DB_HOST', 'localhost'),
- 'port' => env('VECTOR_DB_PORT', '5432'),
- 'database' => env('VECTOR_DB_DATABASE', 'forge'),
- 'username' => env('VECTOR_DB_USERNAME', 'forge'),
- 'password' => env('VECTOR_DB_PASSWORD', ''),
- 'charset' => 'utf8',
- 'prefix' => '',
- 'prefix_indexes' => true,
- 'search_path' => 'public',
- 'sslmode' => 'prefer',
- ],
-
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
diff --git a/database/migrations/2022_08_03_000000_create_vector_extension.php b/database/migrations/2022_08_03_000000_create_vector_extension.php
index a81ef7679..e785a2415 100644
--- a/database/migrations/2022_08_03_000000_create_vector_extension.php
+++ b/database/migrations/2022_08_03_000000_create_vector_extension.php
@@ -11,7 +11,14 @@
*/
public function up()
{
- DB::connection('pgvector')->statement('CREATE EXTENSION IF NOT EXISTS vector');
+ // The pgvector connection was removed later so it may not always be present.
+ // There is a second migration that enables pgvector for the default connection.
+ // See: https://github.com/biigle/maia/pull/150
+ if (!is_null(config('database.connections-pgvector'))) {
+ DB::connection('pgvector')
+ ->statement('CREATE EXTENSION IF NOT EXISTS vector');
+
+ }
}
/**
@@ -21,6 +28,10 @@ public function up()
*/
public function down()
{
- DB::connection('pgvector')->statement('DROP EXTENSION IF EXISTS vector');
+ if (!is_null(config('database.connections-pgvector'))) {
+ DB::connection('pgvector')
+ ->statement('DROP EXTENSION IF NOT EXISTS vector');
+
+ }
}
};
diff --git a/database/migrations/2023_12_12_150300_create_vector_extension.php b/database/migrations/2023_12_12_150300_create_vector_extension.php
new file mode 100644
index 000000000..b53387f08
--- /dev/null
+++ b/database/migrations/2023_12_12_150300_create_vector_extension.php
@@ -0,0 +1,26 @@
+
-
-
-
-
diff --git a/tests/TestCase.php b/tests/TestCase.php
index ca99c5317..dd25deb8c 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -2,7 +2,6 @@
use Biigle\Tests\CreatesApplication;
use Illuminate\Foundation\Testing\RefreshDatabase;
-use Illuminate\Foundation\Testing\RefreshDatabaseState;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\Queue;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
@@ -10,20 +9,10 @@
class TestCase extends BaseTestCase
{
use CreatesApplication, MockeryPHPUnitIntegration, RefreshDatabase;
- use RefreshDatabase {
- refreshTestDatabase as protected originalRefreshTestDatabase;
- }
public static $cachedPdo;
- public static $cachedVectorPdo;
-
protected $baseUrl = 'http://localhost';
- protected $connectionsToTransact = [
- 'pgsql',
- 'pgvector',
- ];
-
/**
* Default preparation for each test.
*/
@@ -54,21 +43,5 @@ protected function beforeRefreshingDatabase()
} else {
static::$cachedPdo = DB::getPdo();
}
-
- if (static::$cachedVectorPdo) {
- DB::connection('pgvector')->setPdo(static::$cachedVectorPdo);
- } else {
- static::$cachedVectorPdo = DB::connection('pgvector')->getPdo();
- }
- }
-
- // Custom implementation to wipe the vector database, too.
- protected function refreshTestDatabase()
- {
- if (!RefreshDatabaseState::$migrated) {
- $this->artisan('db:wipe', ['--database' => 'pgvector']);
- }
-
- $this->originalRefreshTestDatabase();
}
}