Skip to content

fix: correct boolean check in doesSchemaExists - #968

Merged
fenos merged 1 commit into
supabase:masterfrom
oniani1:fix/does-schema-exist-boolean-check
Apr 6, 2026
Merged

fix: correct boolean check in doesSchemaExists#968
fenos merged 1 commit into
supabase:masterfrom
oniani1:fix/does-schema-exist-boolean-check

Conversation

@oniani1

@oniani1 oniani1 commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #928

doesSchemaExists compares the result of SELECT EXISTS(...) with the string 'true', but the pg driver returns a JavaScript boolean. So true === 'true' is always false, meaning the function always reports the schema doesn't exist.

This causes the migration to always run CREATE SCHEMA IF NOT EXISTS storage, which fails for self-hosted setups where the DB user has permissions within the storage schema but not CREATE on the database itself.

The fix aligns with how doesTableExist (same file, line 794) already handles the check -- just using the boolean value directly.

@oniani1
oniani1 requested a review from a team as a code owner April 5, 2026 20:30
@fenos

fenos commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Great catch @oniani1!

@fenos
fenos merged commit 6e988b5 into supabase:master Apr 6, 2026
1 of 3 checks passed
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.

doesSchemaExist will always return false

2 participants