Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes an issue where missing rooms in the Supabase database caused errors when fetching them using
.single()
. Additionally, ensures that the database seed values contain valid timestamps and required non-null fields. Also fixes an issue where mixed-case column names were interpreted as lowercase in Supabase PostgreSQL.Relates to
N/A
Risks
getRoom()
function inadapter-supabase/index.ts
.seed.sql
.Background
What does this PR do?
getRoom()
in the Supabase adapter to use.maybeSingle()
instead of.single()
, preventing crashes when no room is found."createdAt"
timestamp for therooms
table."id"
for theparticipants
table."createdAt"
timestamp for theparticipants
table."userState"
and"last_message_read"
are explicitly set to prevent null constraint violations.What kind of change is this?
Why are we doing this? Any context or related work?
When attempting to use the seeds.sql text in supabase I received several errors related to column names:
... for example.
When running start in Eliza, after creating the supabase db I recieved this error:
I needed to fix these error in order to use Supabase/postgres.
Documentation changes needed?
Testing
Where should a reviewer start?
adapter-supabase/index.ts
.seed.sql
to verify updated default values.Detailed testing steps
getRoom()
function:Deploy Notes
No special deployment steps required; normal database migrations and API updates should suffice.
Database changes
None
Deployment instructions
None
🚀 Summary of Fixes
✔️ Ensured mixed-case column names are quoted (
"columnName"
) in SQL queries.✔️ Updated
getRoom()
to select"id"
explicitly with correct casing.✔️ Modified
seed.sql
to quote"createdAt"
,"avatarUrl"
, and other mixed-case columns.✔️ Prevented crashes in Supabase when fetching missing rooms.
Discord username
4n7m4n