Add postgres database context to chatbot integration
The following SQL query:
```sql
SELECT
t.table_schema,
t.table_name,
c.column_name,
c.data_type
FROM
(SELECT table_schema, table_name
FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
AND table_schema NOT IN ('pg_catalog', 'information_schema')
) AS t
JOIN
information_schema.columns AS c
ON
t.table_schema = c.table_schema
AND t.table_name = c.table_name
ORDER BY
t.table_schema, t.table_name, c.ordinal_position;
```
Can be used to query information about all tables in a given database.
Make an IPC function used by the ElectronAPI that takes in pg connection info and makes the above query. Make the actualy query in. main.ts and wire it up to the app in preload.ts. Make sure to update the types.ts and all the places in the tests where this ElectronAPI type is used.
关闭于 2024-07-30 0 条评论