Skip to content

Commit b6985b2

Browse files
authored
Merge pull request #118 from utopia-php/chore-update-db
Fix validator
2 parents 2072d4a + 65a6286 commit b6985b2

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/Migration/Destinations/Appwrite.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,12 @@ protected function createIndex(Index $resource): bool
733733
/**
734734
* @var array<UtopiaDocument> $tableColumns
735735
*/
736-
$tableColumns = $table->getAttribute('attributes');
736+
$tableColumns = $table->getAttribute('attributes', []);
737+
738+
/**
739+
* @var array<UtopiaDocument> $tableIndexes
740+
*/
741+
$tableIndexes = $table->getAttribute('indexes', []);
737742

738743
$oldColumns = \array_map(
739744
fn ($attr) => $attr->getArrayCopy(),
@@ -840,9 +845,16 @@ protected function createIndex(Index $resource): bool
840845

841846
$validator = new IndexValidator(
842847
$tableColumns,
848+
$tableIndexes,
843849
$this->database->getAdapter()->getMaxIndexLength(),
844850
$this->database->getAdapter()->getInternalIndexesKeys(),
845851
$this->database->getAdapter()->getSupportForIndexArray(),
852+
$this->database->getAdapter()->getSupportForSpatialIndexNull(),
853+
$this->database->getAdapter()->getSupportForSpatialIndexOrder(),
854+
$this->database->getAdapter()->getSupportForVectors(),
855+
$this->database->getAdapter()->getSupportForAttributes(),
856+
$this->database->getAdapter()->getSupportForMultipleFulltextIndexes(),
857+
$this->database->getAdapter()->getSupportForIdenticalIndexes(),
846858
);
847859

848860
if (!$validator->isValid($index)) {

0 commit comments

Comments
 (0)