Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres Adapter schema check is nonsensical #1376

Open
ryanleecode opened this issue Dec 22, 2024 · 0 comments
Open

Postgres Adapter schema check is nonsensical #1376

ryanleecode opened this issue Dec 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ryanleecode
Copy link
Contributor

Describe the bug

The following check is nonsensical because we already do IF NOT EXIST checks within the sql. If one of the tables were dropped, say for example the memories table because we want to change the vector dimensions, it wouldn't be recreated due to this check.

// 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);
}

https://github.com/elizaOS/eliza/blob/4c658d7d70433fdcb2feeffe879429eaef10685d/packages/adapter-postgres/src/index.ts#L192C13-L206C14

To Reproduce

Expected behavior

Screenshots

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant