Skip to content

feat: add pglite db adapter#1810

Merged
wtfsayo merged 5 commits intoelizaOS:developfrom
KONFeature:1809-add-pglite-adapter
Jan 7, 2025
Merged

feat: add pglite db adapter#1810
wtfsayo merged 5 commits intoelizaOS:developfrom
KONFeature:1809-add-pglite-adapter

Conversation

@KONFeature
Copy link
Copy Markdown
Contributor

Relates to

Issue: #1809

Risks

Low risk, if any would only impact dev env (since no one is running with an sqlite/pglite adapter in prod right?).

Background

What does this PR do?

Add a new db adapter for PGLite.

What kind of change is this?

Features

Why are we doing this? Any context or related work?

Faster dev env

Documentation changes needed?

My changes require a change to the project documentation, and I have updated the documentation accordingly.
For now I only specified added the new db adapter in the adapters section of the doc, and not replaced all the dev recommendation from SQLiteAdapter to PGLite.

Testing

Where should a reviewer start?

Check the diff between the adapter-pglite and the adapter-postgres.
A few changes made but not super significative:

  • Exploit pglite.transaction(...) instead of manual pg tx
  • Typed db.query call
  • Remove stuff related to distant connection (the withRetry), the circuitBreaker usage could also be removed, but I keeped it to reduce the amount of changes.

Detailed testing steps

Multiple options:

  • In the packages/core/env.test, set TEST_DATABASE_CLIENT=pglite
  • By manually testing, you can add a PGLITE_DATA_DIR=../pgLite/ # or "memory://" for in mem pglite env variable and ensure everything is running smoothly
  • Or manually running everything const db = new PGLiteAdapter(options)

Discord username

konfeature

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @KONFeature! Welcome to the ai16z community. Thanks for submitting your first pull request; your efforts are helping us accelerate towards AGI. We'll review it shortly. You are now a ai16z contributor!

@KONFeature KONFeature changed the base branch from main to develop January 4, 2025 12:24
@wtfsayo
Copy link
Copy Markdown
Member

wtfsayo commented Jan 6, 2025

looks good overall; needs testing

@wtfsayo wtfsayo self-requested a review January 7, 2025 10:06
wtfsayo
wtfsayo previously approved these changes Jan 7, 2025
Copy link
Copy Markdown
Member

@wtfsayo wtfsayo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated .env.example, looks good, worked fine

@wtfsayo wtfsayo self-requested a review January 7, 2025 11:47
Copy link
Copy Markdown
Member

@wtfsayo wtfsayo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all good now; ty

@wtfsayo wtfsayo merged commit 3011fca into elizaOS:develop Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants