Skip to content

Commit bea96d3

Browse files
committed
Fix #167 Sort index name alphabetically
1 parent 2d9bfc2 commit bea96d3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/DBAL/Models/PgSQL/PgSQLTable.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ protected function handle(): void
2424
$this->repository = app(PgSQLRepository::class);
2525

2626
$this->pushFulltextIndexes();
27+
28+
$this->indexes = $this->indexes->sortBy(function (Index $index) {
29+
return $index->getName();
30+
})->values();
2731
}
2832

2933
/**

src/Repositories/PgSQLRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ public function getFulltextIndexes(string $table): Collection
143143
indexdef
144144
FROM pg_indexes
145145
WHERE tablename = '$table'
146-
AND indexdef LIKE '%to_tsvector(%'"
146+
AND indexdef LIKE '%to_tsvector(%'
147+
ORDER BY indexname"
147148
);
148149
$definitions = new Collection();
149150

0 commit comments

Comments
 (0)