Skip to content

Commit

Permalink
Merge pull request #1377 from ryanleecode/fix/postgres-adapter-schema…
Browse files Browse the repository at this point in the history
…-check

fix: postgres-adapter - remove nonsensical schema check
  • Loading branch information
odilitime authored Jan 3, 2025
2 parents 2b6c6a9 + cf02297 commit a5dc13c
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions packages/adapter-postgres/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,11 @@ export class PostgresDatabaseAdapter
await client.query("SET app.use_gaianet_embedding = 'false'");
}

// Check if schema already exists (check for a core table)
const { rows } = await client.query(`
SELECT EXISTS (
SELECT FROM information_schema.tables
WHERE table_name = 'rooms'
);
`);

if (!rows[0].exists) {
const schema = fs.readFileSync(
path.resolve(__dirname, "../schema.sql"),
"utf8"
);
await client.query(schema);
}
const schema = fs.readFileSync(
path.resolve(__dirname, "../schema.sql"),
"utf8"
);
await client.query(schema);

await client.query("COMMIT");
} catch (error) {
Expand Down

0 comments on commit a5dc13c

Please sign in to comment.