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

Supabase Adapter Updates and Scheme Create Functions #3290

Closed
wants to merge 10 commits into from

Conversation

rferrari
Copy link
Contributor

@rferrari rferrari commented Feb 5, 2025

Relates to

#1389
#3160

Risks

Low – This PR primarily updates the schema and seed files with minimal code changes.

Background

This PR addresses issues with the Supabase adapter by updating the schema and seed files. The previous implementation did not correctly create rooms and memories, leading to inconsistencies in data persistence.

What does this PR do?

  • Changes Introduced
  • Updated the Supabase adapter to correctly handle create_room and create_memory operations.
  • Fixed issues in the schema.sql and seed.sql files.
  • Minimal code changes to improve functionality without introducing breaking changes.

What kind of change is this?

Bug fixes (non-breaking change which fixes an issue)

The Supabase adapter was not correctly creating rooms and memories due to outdated or incorrect schema definitions. This update ensures the expected behavior when interacting with the database.

Documentation changes needed?

My changes do not require a change to the project documentation.

Testing

-Add the following environment variables to your .env file:

SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key

-Drop all tables, functions and triggers from your current supabase.
-Import and execute scheme.sql to supabase using SQL Editor.
-Import seed.sql to supabase
-Start Eliza.
-Verify that rooms and memories are correctly created and selected in the Supabase dashboard.

Where should a reviewer start?

packages/adapter-supabase/src/index.ts
packages/adapter-supabase/schema.sql
packages/adapter-supabase/seed.sql

Detailed testing steps

  1. Start Eliza with the updated Supabase adapter.
  2. Trigger room and memory creation events.
  3. Check the Supabase dashboard to confirm the expected records are created.
  4. Review logs for errors or unexpected behavior.

Before

  • ERROR: Error adding participant: operator does not exist: timestamp with time zone / numeric
  • ERROR: "code":"PGRST202","details":"Searched for the function public.get_embedding_list with parameters query_field_name, query_field_sub_name, query_input, query_match_count, query_table_name, query_threshold or with a single unnamed json/jsonb parameter, but no matches were found in the schema cache.
  • ERROR: Error creating room: Could not find the function public.create_room(roomId) in the schema cache at SupabaseDatabaseAdapter.createRoom
  • ERROR: {"code":"22008","details":null,"hint":"Perhaps you need a different "datestyle" setting.","message":"date/time field value out of range: "1738506666089""}
    at SupabaseDatabaseAdapter.createMemory

Screenshots

image image
image image

Discord username

vaipraonde

Copy link
Contributor

coderabbitai bot commented Feb 5, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@chlenc
Copy link

chlenc commented Feb 6, 2025

Hey
I trying tu use supabase
How to init tables? it seems like there is no init fun
telegram-cloud-photo-size-2-5271933272370309256-y

@rferrari
Copy link
Contributor Author

rferrari commented Feb 6, 2025

@chlenc

-Drop all tables, functions and triggers from your current supabase.
-Import and execute scheme.sql to supabase using SQL Editor.
-Import seed.sql to supabase

@lalalune
Copy link
Member

lalalune commented Feb 7, 2025

Hey @rferrari this is great but heads up, we're moving plugins to their own repos:
check out https://github.com/elizaos-plugins/adapter-supabase
You can develop with npm link, we'll be pushing more to help with this, and we're looking for individual plugin maintainers

Closing this for now, would love to review if we can merge it into the individual repo on elizaos-plugins repo.

@lalalune lalalune closed this Feb 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.

3 participants