fix(migrations): preserve source DSN for documentsdb/vectorsdb resolver

Migration lib 1.10.2's getDatabaseDSN resolver returns the value
written into destination's _databases.database. The previous resolver
always returned the project's main DSN (mongodb in default CI) for
every database type, including documentsdb / vectorsdb — which are
routed to their own adapters (mongodb / postgresql) per
_APP_DB_ADAPTER_DOCUMENTSDB / _APP_DB_ADAPTER_VECTORSDB.

The wrong DSN routed vectorsdb attribute creates back to mongodb,
producing 'Vector types are not supported by the current database'
on the MixedDatabases / VectorsDB migration tests.

Mirror cloud's resolver: keep the source DSN for documentsdb /
vectorsdb (they target dedicated hosts), use destination project's
main DSN otherwise.
This commit is contained in:
Prem Palanisamy
2026-05-10 22:09:39 +01:00
parent 817172c460
commit fd625fca7b
+4 -1
View File
@@ -293,7 +293,10 @@ class Migrations extends Action
$this->getDatabasesDB,
Config::getParam('collections', [])['databases']['collections'],
OnDuplicate::tryFrom($options['onDuplicate'] ?? '') ?? OnDuplicate::Fail,
fn () => (string) $this->project->getAttribute('database', ''),
fn (ResourceDatabase $resource) => match ($resource->getType()) {
DATABASE_TYPE_DOCUMENTSDB, DATABASE_TYPE_VECTORSDB => (string) $resource->getDatabase(),
default => (string) $this->project->getAttribute('database', ''),
},
),
DestinationCSV::getName() => new DestinationCSV(
$this->deviceForFiles,