-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix(plugin-sql): Fix database schema type mismatch for server_agents … #5278
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
fix(plugin-sql): Fix database schema type mismatch for server_agents … #5278
Conversation
…foreign key constraint - Change serverAgent.serverId from uuid to text type - Fixes foreign key constraint error preventing database initialization - Resolves issue where server_agents table could not be created - Maintains backward compatibility with existing UUID values
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@bealers can you please elaborate what is the issue with using |
|
@0xbbjoker I noticed a sql error on database creation when I was debugging some of my own work. This fix just allows the database to create OK. UUID seems the better option tbh. but seemed a larger fix |
|
@bealers |
|
@bealers can you give steps to reproduce this? Might be that other tables need change from |
|
Hi, fair re: UUID, and you're right, the better option is prob fix the relationship the other direction. I've been playing with docker-compose deployments using postgres, and kept getting database errors in the logs. To reproduce basically, serverAgent.server_id is UUID Ah, one other thing. You only notice this in PROD (which is what I was testing), in dev the error is suppressed |
|
@0xbbjoker maybe I should have just reported a bug next time, I got carried away trying to fix my stuff |
|
@bealers no no, all good. Just trying to figure out what's the exact issue. Can you change I guess it's much better to have |
|
Sure, NP. I'll do that and re-submit |
f42b099 to
2303399
Compare
…broken foreign key constraints
cee005b to
084400d
Compare
fix(plugin-sql): Fix database schema type mismatch for server_agents foreign key constraint
Relates to
Fixes critical database initialization bug affecting all fresh ElizaOS deployments
Risks
Low risk - This is a targeted schema fix with minimal impact:
Background
What does this PR do?
Fixes a critical database schema type mismatch that prevents the
server_agentstable from being created during fresh ElizaOS installations. Changes theserverIdfield type fromuuidtotextto match the referencedmessage_servers.idfield type.What kind of change is this?
Bug fixes (non-breaking change which fixes an issue)
Documentation changes needed?
My changes do not require a change to the project documentation.
Testing
Where should a reviewer start?
Review the single file change in
packages/plugin-sql/src/schema/serverAgent.ts- it's a simple type change fromuuidtotext.Detailed testing steps
bun install && bun run buildelizaos create test-schema-fix -yrm -rf .eliza/.elizadbScreenshots
Before
Database initialization would fail with:
After
Database changes
Schema change only - no data migration required:
packages/plugin-sql/src/schema/serverAgent.ts: ChangedserverIdfield fromuuid('server_id')totext('server_id')messageServerTable.idwhich is defined astextDiscord username
bealers