mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 07:01:07 +03:00
Fix(PostgresRecordManager): Handle time correctly and ensure schema creation (#4381)
added pgvector check and time handling for postgresql record manager
This commit is contained in:
+4
-2
@@ -227,6 +227,8 @@ class PostgresRecordManager implements RecordManagerInterface {
|
||||
const queryRunner = dataSource.createQueryRunner()
|
||||
const tableName = this.sanitizeTableName(this.tableName)
|
||||
|
||||
await queryRunner.query('CREATE EXTENSION IF NOT EXISTS pgcrypto;')
|
||||
|
||||
await queryRunner.manager.query(`
|
||||
CREATE TABLE IF NOT EXISTS "${tableName}" (
|
||||
uuid UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
@@ -258,9 +260,9 @@ class PostgresRecordManager implements RecordManagerInterface {
|
||||
const dataSource = await this.getDataSource()
|
||||
try {
|
||||
const queryRunner = dataSource.createQueryRunner()
|
||||
const res = await queryRunner.manager.query('SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)')
|
||||
const res = await queryRunner.manager.query('SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) AS now')
|
||||
await queryRunner.release()
|
||||
return Number.parseFloat(res[0].extract)
|
||||
return Number.parseFloat(res[0].now)
|
||||
} catch (error) {
|
||||
console.error('Error getting time in PostgresRecordManager:')
|
||||
throw error
|
||||
|
||||
Reference in New Issue
Block a user