mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +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 queryRunner = dataSource.createQueryRunner()
|
||||||
const tableName = this.sanitizeTableName(this.tableName)
|
const tableName = this.sanitizeTableName(this.tableName)
|
||||||
|
|
||||||
|
await queryRunner.query('CREATE EXTENSION IF NOT EXISTS pgcrypto;')
|
||||||
|
|
||||||
await queryRunner.manager.query(`
|
await queryRunner.manager.query(`
|
||||||
CREATE TABLE IF NOT EXISTS "${tableName}" (
|
CREATE TABLE IF NOT EXISTS "${tableName}" (
|
||||||
uuid UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
uuid UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
@@ -258,9 +260,9 @@ class PostgresRecordManager implements RecordManagerInterface {
|
|||||||
const dataSource = await this.getDataSource()
|
const dataSource = await this.getDataSource()
|
||||||
try {
|
try {
|
||||||
const queryRunner = dataSource.createQueryRunner()
|
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()
|
await queryRunner.release()
|
||||||
return Number.parseFloat(res[0].extract)
|
return Number.parseFloat(res[0].now)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error getting time in PostgresRecordManager:')
|
console.error('Error getting time in PostgresRecordManager:')
|
||||||
throw error
|
throw error
|
||||||
|
|||||||
Reference in New Issue
Block a user