@mastra/pg 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs +31 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -8
- package/dist/index.js.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -837,14 +837,37 @@ var PgVector = class extends MastraVector {
|
|
|
837
837
|
async listIndexes() {
|
|
838
838
|
const client = await this.pool.connect();
|
|
839
839
|
try {
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
840
|
+
const mastraTablesQuery = `
|
|
841
|
+
SELECT DISTINCT t.table_name
|
|
842
|
+
FROM information_schema.tables t
|
|
843
|
+
WHERE t.table_schema = $1
|
|
844
|
+
AND EXISTS (
|
|
845
|
+
SELECT 1
|
|
846
|
+
FROM information_schema.columns c
|
|
847
|
+
WHERE c.table_schema = t.table_schema
|
|
848
|
+
AND c.table_name = t.table_name
|
|
849
|
+
AND c.column_name = 'vector_id'
|
|
850
|
+
AND c.data_type = 'text'
|
|
851
|
+
)
|
|
852
|
+
AND EXISTS (
|
|
853
|
+
SELECT 1
|
|
854
|
+
FROM information_schema.columns c
|
|
855
|
+
WHERE c.table_schema = t.table_schema
|
|
856
|
+
AND c.table_name = t.table_name
|
|
857
|
+
AND c.column_name = 'embedding'
|
|
858
|
+
AND c.udt_name = 'vector'
|
|
859
|
+
)
|
|
860
|
+
AND EXISTS (
|
|
861
|
+
SELECT 1
|
|
862
|
+
FROM information_schema.columns c
|
|
863
|
+
WHERE c.table_schema = t.table_schema
|
|
864
|
+
AND c.table_name = t.table_name
|
|
865
|
+
AND c.column_name = 'metadata'
|
|
866
|
+
AND c.data_type = 'jsonb'
|
|
867
|
+
);
|
|
868
|
+
`;
|
|
869
|
+
const mastraTables = await client.query(mastraTablesQuery, [this.schema || "public"]);
|
|
870
|
+
return mastraTables.rows.map((row) => row.table_name);
|
|
848
871
|
} catch (e) {
|
|
849
872
|
const mastraError = new MastraError(
|
|
850
873
|
{
|