Skip to content

Remove redundant tests in migrations/tests/database/exists.sql #1561

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

Open
steve-chavez opened this issue Apr 21, 2025 · 0 comments
Open

Remove redundant tests in migrations/tests/database/exists.sql #1561

steve-chavez opened this issue Apr 21, 2025 · 0 comments

Comments

@steve-chavez
Copy link
Member

Problem

We currently have these tests:

SELECT has_schema('public');
SELECT has_schema('auth');
SELECT has_schema('extensions');
SELECT has_schema('graphql');
SELECT has_schema('graphql_public');
SELECT has_schema('realtime');
SELECT has_schema('storage');

As one example, has_schema('storage'); is redundant with

-- storage schema owner
select
n.nspname as schema_name,
r.rolname as owner
from
pg_namespace n
join
pg_roles r on n.nspowner = r.oid
where
n.nspname = 'storage';
schema_name | owner
-------------+----------------
storage | supabase_admin
(1 row)

Which provides more information.

Editing the exists.sql file makes up for more work on PRs (example) while not providing any more test coverage.

Additionally, it's easier to locate all storage concerns in a single file, the same for the other schemas.

Solution

Remove migrations/tests/database/exists.sql while ensuring the test coverage is preserved.

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

No branches or pull requests

1 participant