Skip to content

Commit

Permalink
fix: remove nonsensical schema check from postgres-adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanleecode committed Dec 23, 2024
1 parent c735ef7 commit 8e456a2
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 @@ -203,21 +203,11 @@ export class PostgresDatabaseAdapter
await client.query("SET app.use_ollama_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 8e456a2

Please sign in to comment.